Module: LocoStrings

Defined in:
lib/loco_strings.rb,
lib/loco_strings/version.rb,
lib/loco_strings/parsers/ios_file.rb,
lib/loco_strings/parsers/loco_file.rb,
lib/loco_strings/parsers/android_file.rb,
lib/loco_strings/parsers/xcstrings_file.rb,
lib/loco_strings/decoders/xcstrings_decoder.rb,
lib/loco_strings/encoders/xcstrings_encoder.rb

Overview

LocoStrings is a Ruby gem for working with iOS and Android localization strings.

Defined Under Namespace

Classes: AndroidFile, Error, IosFile, LocoFile, LocoString, LocoVariantions, XCStringsDecoder, XCStringsEncoder, XCStringsFile

Constant Summary collapse

VERSION =
"0.1.5"

Class Method Summary collapse

Class Method Details

.load(file_path) ⇒ Object

rubocop:disable Metrics/MethodLength

Raises:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/loco_strings.rb', line 63

def self.load(file_path) # rubocop:disable Metrics/MethodLength
  ext = File.extname(file_path)
  raise Error, "Unsupported file format: #{ext}" unless [".strings", ".xml", ".xcstrings"].include? ext

  case ext
  when ".strings"
    IosFile.new file_path
  when ".xml"
    AndroidFile.new file_path
  when ".xcstrings"
    XCStringsFile.new file_path
  else
    raise Error, "Not implemented"
  end
end