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.4.1"

Class Method Summary collapse

Class Method Details

.load(file_path) ⇒ Object

rubocop:disable Metrics/MethodLength

Raises:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/loco_strings.rb', line 51

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