Sha256: e4e511fec2a579f03d365654ff326a6fc7c669f08f6b2842f5bec71c7e66a774

Contents?: true

Size: 824 Bytes

Versions: 1

Compression:

Stored size: 824 Bytes

Contents

# frozen_string_literal: true

require 'xcodeproj'

module GoNative
  module Plugins
    module IOS
      class AddLanguage
        extend DSL::Serviceable

        attr_reader :language

        def initialize(language)
          @language = language
        end

        def call
          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

        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
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gonative-cli-1.3.7 lib/gonative/plugins/ios/add_language.rb