class Translatomatic::ResourceFile::XCodeStrings

XCode strings resource file @see developer.apple.com/library/content/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html

Public Class Methods

extensions() click to toggle source

(see Base.extensions)

# File lib/translatomatic/resource_file/xcode_strings.rb, line 11
def self.extensions
  %w[strings]
end

Private Instance Methods

comment_to_s(text) click to toggle source
# File lib/translatomatic/resource_file/xcode_strings.rb, line 30
def comment_to_s(text)
  comment = text && text.start_with?(' ') ? text : " #{text} "
  "/*#{comment}*/\n"
end
definition_to_s(key, value) click to toggle source
# File lib/translatomatic/resource_file/xcode_strings.rb, line 25
def definition_to_s(key, value)
  format(%("%<key>s" = "%<value>s";\n\n), key: escape(key),
                                          value: escape(value))
end
parse_doc(content) click to toggle source
# File lib/translatomatic/resource_file/xcode_strings.rb, line 21
def parse_doc(content)
  Parser.new.parse(content)
end
render_element(element) click to toggle source
# File lib/translatomatic/resource_file/xcode_strings.rb, line 35
def render_element(element)
  if element.is_a? Comment
    comment_to_s(element.text)
  elsif element.is_a? Definition
    definition_to_s(element.key, element.value)
  end
end