i18n: Encode string lengths after strip #1535
@ -19,13 +19,16 @@ module Weblate
|
|||||||
|
|
||||||
class ID
|
class ID
|
||||||
def self.get(source_text)
|
def self.get(source_text)
|
||||||
source_text.nil? or source_text.empty? ? source_text
|
if source_text.nil? or source_text.empty?
|
||||||
: source_text.strip[0..150]
|
source_text
|
||||||
.gsub(/([^\w\d\s\.\?\!]|\n)/, '')
|
else
|
||||||
.tr(' ', '_')
|
len_encoding = source_text.strip.length.to_s
|
||||||
.tr('.', 'P')
|
source_text.strip[0..150].gsub(/([^\w\d\s\.\?\!]|\n)/, '')
|
||||||
.tr('?', 'Q')
|
.tr(' ', '_')
|
||||||
.tr('!', 'E') << "_" << source_text.length.to_s << "_KEY"
|
.tr('.', 'P')
|
||||||
|
.tr('?', 'Q')
|
||||||
|
.tr('!', 'E') << "_" << len_encoding << "_KEY"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user