class Locca::XcodeProject
Attributes
langs[R]
Public Class Methods
new(dir, xcode_target, config)
click to toggle source
Calls superclass method
Locca::Project::new
# File lib/locca/projects/xcode_project.rb, line 32 def initialize(dir, xcode_target, config) super(dir, config) @xcode_target = xcode_target @files = Array.new() @langs = Set.new() @xcode_target.resources_build_phase.files_references.each { |file| if file.display_name.end_with?(".strings") && file.is_a?(Xcodeproj::Project::Object::PBXVariantGroup) @files.push(file) if file.display_name == "Localizable.strings" file.files.each { |variant_file| @langs.add(variant_file.name) } end end } end
Public Instance Methods
collection_builder()
click to toggle source
# File lib/locca/projects/xcode_project.rb, line 83 def collection_builder() parser = Babelyoda::StringsParser.new(Babelyoda::StringsLexer.new()) return CollectionBuilder.new(File, parser) end
collection_names()
click to toggle source
# File lib/locca/projects/xcode_project.rb, line 55 def collection_names result = Set.new() @files.each { |file| result.add(File.basename(file.display_name, '.strings')) } return result end
collection_writer()
click to toggle source
# File lib/locca/projects/xcode_project.rb, line 88 def collection_writer() return CollectionWriter.new(File, CollectionItemDefaultFormatter.new()) end
collections_generator()
click to toggle source
# File lib/locca/projects/xcode_project.rb, line 92 def collections_generator() source_files = Array.new() @xcode_target.source_build_phase.files_references.each { |file| if !file.path.nil? source_files.push(file.real_path.to_s) end } return CollectionsGenerator.new(source_files, Genstrings.new(), collection_builder()) end
full_collection_name(collection_name)
click to toggle source
# File lib/locca/projects/xcode_project.rb, line 64 def full_collection_name(collection_name) return "#{collection_name}.strings" end
name()
click to toggle source
# File lib/locca/projects/xcode_project.rb, line 51 def name return @xcode_target.name end
one_sky_file_format()
click to toggle source
# File lib/locca/projects/xcode_project.rb, line 102 def one_sky_file_format return "IOS_STRINGS" end
path_for_collection(collection_name, lang)
click to toggle source
# File lib/locca/projects/xcode_project.rb, line 68 def path_for_collection(collection_name, lang) collection_name = "#{collection_name}.strings" @files.each { |file| if file.display_name == collection_name file.files.each { |variant_file| if variant_file.name == lang return variant_file.real_path end } end } return nil end