Sha256: 7959fb87a79e89cd684b05df161d8e151a8c50a7af695f3345b674586311aaad

Contents?: true

Size: 547 Bytes

Versions: 8

Compression:

Stored size: 547 Bytes

Contents

module PolyglotIos
  module Resource
    class TranslationKey < Base

      def clean_translation(language)
        translation_value = name
        translation = translations.find { |key| key.language.id == language.id }
        if translation && translation.value
          translation_value = translation.value
        end
        escape_translation(translation_value)
      end

      private

      def escape_translation(translation)
        translation
          .gsub("\"", "\\\"")
          .gsub("%s", "%@")
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ios_polyglot_cli-2.4.0 lib/ios_polyglot_cli/api/translation_key.rb
ios_polyglot_cli-2.3.0 lib/ios_polyglot_cli/api/translation_key.rb
ios_polyglot_cli-2.2.2 lib/ios_polyglot_cli/api/translation_key.rb
ios_polyglot_cli-2.2.1 lib/ios_polyglot_cli/api/translation_key.rb
ios_polyglot_cli-2.2.0 lib/ios_polyglot_cli/api/translation_key.rb
ios_polyglot_cli-2.1.1 lib/ios_polyglot_cli/api/translation_key.rb
ios_polyglot_cli-2.1.0 lib/ios_polyglot_cli/api/translation_key.rb
ios_polyglot_cli-2.0.1 lib/ios_polyglot_cli/api/translation_key.rb