Sha256: c52826cef9cc6b679e0c4135a347b438efd9c03f35c341d8156b8dc96cf32369

Contents?: true

Size: 689 Bytes

Versions: 8

Compression:

Stored size: 689 Bytes

Contents

# -*- encoding : utf-8 -*-

class Phrase::Tool::Formats::Strings < Phrase::Tool::Formats::Base
  def self.directory_for_locale(locale)
    name = locale.code || locale.name
    "#{formatted(name)}.lproj"
  end
  
  def self.filename_for_locale(locale)
    "Localizable.strings"
  end
  
  def self.target_directory
    "./"
  end

  def self.extract_locale_name_from_file_path(file_path)
    file_path.scan(/\/([a-zA-Z\-_]*).lproj\//i).first.try(:first)
  end
  
  def self.locale_aware?
    true
  end
  
  def self.formatted(name)
    return name unless name.include?("-")
    parts = name.split("-")
    "#{parts.first}_#{parts.last.upcase}"
  end
  private_class_method :formatted
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
phrase-0.4.1 lib/phrase/tool/formats/strings.rb
phrase-0.4.0 lib/phrase/tool/formats/strings.rb
phrase-0.3.7 lib/phrase/tool/formats/strings.rb
phrase-0.3.6 lib/phrase/tool/formats/strings.rb
phrase-0.3.5 lib/phrase/tool/formats/strings.rb
phrase-0.3.4 lib/phrase/tool/formats/strings.rb
phrase-0.3.3 lib/phrase/tool/formats/strings.rb
phrase-0.3.2 lib/phrase/tool/formats/strings.rb