Append _KEY to keys and strip newlines from ID

Some strings such as "Yes" and "No" refuse to be translated, so
we need to pad the IDs somehow.
This commit is contained in:
djoate
2019-11-24 13:01:04 -05:00
parent 1a2996e80c
commit 8b5226d388

View File

@ -19,8 +19,10 @@ module Weblate
class ID class ID
def self.get(source_text) def self.get(source_text)
source_text.nil? ? source_text source_text.nil? or source_text.empty? ? source_text
: source_text.strip[0..100].gsub(/[^\w\d\s\.\?\!]/, '').tr(' ', '_') : source_text.strip[0..100]
.gsub(/([^\w\d\s\.\?\!]|\n)/, '')
.tr(' ', '_') << "_KEY"
end end
end end