Class: BabelishRnc::CSV2Strings
- Defined in:
- lib/babelish_rnc/csv2strings.rb
Instance Attribute Summary collapse
-
#languages ⇒ Object
Returns the value of attribute languages.
Attributes inherited from Csv2Base
#comments_column, #csv_filename, #csv_separator, #default_lang, #excluded_states, #ignore_lang_path, #keys_column, #langs, #output_dir, #state_column
Instance Method Summary collapse
- #extension ⇒ Object
- #get_row_format(row_key, row_value, comment = nil, indentation = 0, defaultlang = "") ⇒ Object
- #language_filepaths(language) ⇒ Object
- #output_basename ⇒ Object
Methods inherited from Csv2Base
#comments, #convert, #create_file_from_path, #default_filepath, #hash_to_output, #initialize, #keys, #process_value, #table, #write_content
Constructor Details
This class inherits a constructor from BabelishRnc::Csv2Base
Instance Attribute Details
#languages ⇒ Object
Returns the value of attribute languages.
3 4 5 |
# File 'lib/babelish_rnc/csv2strings.rb', line 3 def languages @languages end |
Instance Method Details
#extension ⇒ Object
26 27 28 |
# File 'lib/babelish_rnc/csv2strings.rb', line 26 def extension "strings" end |
#get_row_format(row_key, row_value, comment = nil, indentation = 0, defaultlang = "") ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/babelish_rnc/csv2strings.rb', line 18 def get_row_format(row_key, row_value, comment = nil, indentation = 0, defaultlang = "") entry = comment.to_s.empty? ? "" : "\n/* #{comment} */\n" row_value = row_value.to_s.empty? ? defaultlang : row_value entry + "\"#{row_key}\"" + " " * indentation + " = \"#{row_value}\";\n" end |
#language_filepaths(language) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/babelish_rnc/csv2strings.rb', line 5 def language_filepaths(language) require 'pathname' filepaths = [] if language.regions.empty? filepaths << Pathname.new(@output_dir) + "#{language.code}.lproj/#{output_basename}.#{extension}" else language.regions.each do |region| filepaths << Pathname.new(@output_dir) + "#{language.code}-#{region}.lproj/#{output_basename}.#{extension}" end end filepaths end |
#output_basename ⇒ Object
30 31 32 |
# File 'lib/babelish_rnc/csv2strings.rb', line 30 def output_basename @output_basename || 'Localizable' end |