Sha256: 63efff0390e7f7edd319c4ee51725b800fcf95f879a01bd5a08c9ab07817a624
Contents?: true
Size: 962 Bytes
Versions: 7
Compression:
Stored size: 962 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 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 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 private def exists? File.directory?("LeanIOS/#{language}.lproj") end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems