Archived
Encode length and punctuation in key IDs (#1524)
This is to ensure we don't end up using the same string for two strings using the same words but different length and punctuation.
This commit was merged in pull request #1524.
This commit is contained in:
1 parent
ab689944d6
commit
e6ff8f3d7a
2 files changed
+2069
-1928
No files matched your search
@@ -21,8 +21,11 @@ module Weblate
|
||||
def self.get(source_text)
|
||||
source_text.nil? or source_text.empty? ? source_text
|
||||
: source_text.strip[0..150]
|
||||
.gsub(/([^\w\d\s\!]|\n)/, '')
|
||||
.tr(' ', '_') << "_KEY"
|
||||
.gsub(/([^\w\d\s\.\?\!]|\n)/, '')
|
||||
.tr(' ', '_')
|
||||
.tr('.', 'P')
|
||||
.tr('?', 'Q')
|
||||
.tr('!', 'E') << "_" << source_text.length.to_s << "_KEY"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+2064
-1926
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user