Class: GoNative::Plugins::IOS::AddLanguage
- Inherits:
-
Object
- Object
- GoNative::Plugins::IOS::AddLanguage
- Extended by:
- DSL::Serviceable
- Defined in:
- lib/gonative/plugins/ios/add_language.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
readonly
Returns the value of attribute language.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(language) ⇒ AddLanguage
constructor
A new instance of AddLanguage.
- #localizable_group(proj) ⇒ Object
Constructor Details
#initialize(language) ⇒ AddLanguage
Returns a new instance of AddLanguage.
13 14 15 |
# File 'lib/gonative/plugins/ios/add_language.rb', line 13 def initialize(language) @language = language end |
Instance Attribute Details
#language ⇒ Object (readonly)
Returns the value of attribute language.
11 12 13 |
# File 'lib/gonative/plugins/ios/add_language.rb', line 11 def language @language end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gonative/plugins/ios/add_language.rb', line 17 def call return unless exists? proj = Xcodeproj::Project.open('MedianIOS.xcodeproj') file = proj.new_file("#{language}.lproj/Localizable.strings") file.move(localizable_group(proj)) file.name = language proj.save end |
#localizable_group(proj) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/gonative/plugins/ios/add_language.rb', line 28 def localizable_group(proj) proj.objects.each do |o| if o.is_a?(Xcodeproj::Project::Object::PBXGroup) && (o.hierarchy_path == '/LeanIOS/Localizable.strings') return o end end nil end |