Sha256: 4eaacb105e54f7b97ce3cd48436042f045218d19b09c767d6611f6b84acdcea2
Contents?: true
Size: 662 Bytes
Versions: 10
Compression:
Stored size: 662 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", "%@") .gsub(/(%\d+)(\$)(s)/, '\1\2@') # Positional parameter support, converts %1$s to %1$@ for example end end end end
Version data entries
10 entries across 10 versions & 1 rubygems