Sha256: c6170dbf06e1e829e5cf9881b7061927fbc1a74a46d58cf8f33261770a6fa806

Contents?: true

Size: 845 Bytes

Versions: 12

Compression:

Stored size: 845 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

12 entries across 12 versions & 1 rubygems

Version Path
phrase-0.4.26 lib/phrase/formats/strings.rb
phrase-0.4.25 lib/phrase/formats/strings.rb
phrase-0.4.24 lib/phrase/formats/strings.rb
phrase-0.4.23 lib/phrase/formats/strings.rb
phrase-0.4.22 lib/phrase/formats/strings.rb
phrase-0.4.21 lib/phrase/formats/strings.rb
phrase-0.4.20 lib/phrase/formats/strings.rb
phrase-0.4.19 lib/phrase/formats/strings.rb
phrase-0.4.18 lib/phrase/formats/strings.rb
phrase-0.4.17 lib/phrase/formats/strings.rb
phrase-0.4.16 lib/phrase/formats/strings.rb
phrase-0.4.15 lib/phrase/formats/strings.rb