Sha256: dde1c50da197a134451005247d70cdb9aeb8dff08f94429badacba06b5939308

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 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.extract_locale_name_from_file_path(file_path)
    file_path.scan(/\/([a-zA-Z\-_]*).lproj\//i).first.try(:first)
  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

2 entries across 2 versions & 1 rubygems

Version Path
phrase-0.3.1 lib/phrase/tool/formats/strings.rb
phrase-0.3.0 lib/phrase/tool/formats/strings.rb