Sha256: 33b25322104f90598c0a7453e662970e1d3a2dd15cf52348068d3b006c218e5c

Contents?: true

Size: 869 Bytes

Versions: 13

Compression:

Stored size: 869 Bytes

Contents

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

module Phrase
  module Formats
    class Strings < Phrase::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

      def self.extensions
        [:strings]
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
phrase-0.4.14 lib/phrase/formats/strings.rb
phrase-0.4.13 lib/phrase/formats/strings.rb
phrase-0.4.12 lib/phrase/formats/strings.rb
phrase-0.4.11 lib/phrase/formats/strings.rb
phrase-0.4.10 lib/phrase/formats/strings.rb
phrase-0.4.9 lib/phrase/formats/strings.rb
phrase-0.4.8 lib/phrase/formats/strings.rb
phrase-0.4.7 lib/phrase/formats/strings.rb
phrase-0.4.6 lib/phrase/formats/strings.rb
phrase-0.4.5 lib/phrase/formats/strings.rb
phrase-0.4.4 lib/phrase/formats/strings.rb
phrase-0.4.3 lib/phrase/formats/strings.rb
phrase-0.4.2 lib/phrase/formats/strings.rb