i18n: Encode length and punctuation in key IDs #1524

Merged
djoate merged 1 commits from i18n-id-encode into i18n-simple 2019-11-26 02:52:32 +00:00
2 changed files with 2069 additions and 1928 deletions

View File

@ -21,8 +21,11 @@ module Weblate
def self.get(source_text) def self.get(source_text)
source_text.nil? or source_text.empty? ? source_text source_text.nil? or source_text.empty? ? source_text
: source_text.strip[0..150] : source_text.strip[0..150]
.gsub(/([^\w\d\s\!]|\n)/, '') .gsub(/([^\w\d\s\.\?\!]|\n)/, '')
.tr(' ', '_') << "_KEY" .tr(' ', '_')
.tr('.', 'P')
.tr('?', 'Q')
.tr('!', 'E') << "_" << source_text.length.to_s << "_KEY"
end end
end end

File diff suppressed because it is too large Load Diff