diff --git a/changelog.md b/changelog.md index cfee801e5d23..6bc9d9985fa4 100644 --- a/changelog.md +++ b/changelog.md @@ -13,6 +13,8 @@ ### Translations * Updated translations: Catalan, Chinese (Traditional), French, Portuguese (Brazil), Spanish + ### Miscellaneous and Bug Fixes + * Added support to wmlxgettext for double-quote characters in translatable raw strings ## Version 1.14.15 ### Add-ons client diff --git a/data/tools/pywmlx/state/machine.py b/data/tools/pywmlx/state/machine.py index c11f1b8482ba..1e39f030b812 100644 --- a/data/tools/pywmlx/state/machine.py +++ b/data/tools/pywmlx/state/machine.py @@ -248,11 +248,13 @@ def store(self): class PendingWmlString: - def __init__(self, lineno, wmlstring, ismultiline, istranslatable): + def __init__(self, lineno, wmlstring, ismultiline, istranslatable, israw): + """The israw argument indicates a << >> delimited string""" self.lineno = lineno self.wmlstring = wmlstring.replace('\\', r'\\') self.ismultiline = ismultiline self.istranslatable = istranslatable + self.israw = israw def addline(self, value): self.wmlstring = self.wmlstring + '\n' + value.replace('\\', r'\\') @@ -275,7 +277,10 @@ def store(self): # so, using "if errcode != 1" # we will add the translatable string ONLY if it is NOT empty _linenosub += 1 - self.wmlstring = re.sub('""', r'\"', self.wmlstring) + if self.israw: + self.wmlstring = re.sub('"', r'\"', self.wmlstring) + else: + self.wmlstring = re.sub('""', r'\"', self.wmlstring) pywmlx.nodemanip.addNodeSentence(self.wmlstring, ismultiline=self.ismultiline, lineno=self.lineno, diff --git a/data/tools/pywmlx/state/wml_states.py b/data/tools/pywmlx/state/wml_states.py index 8f89b2101b27..b471614dd9a5 100644 --- a/data/tools/pywmlx/state/wml_states.py +++ b/data/tools/pywmlx/state/wml_states.py @@ -169,7 +169,7 @@ def run(self, xline, lineno, match): 'please report a bug if you encounter this error message') pywmlx.state.machine._pending_wmlstring = ( pywmlx.state.machine.PendingWmlString( - lineno, loc_string, loc_multiline, loc_translatable + lineno, loc_string, loc_multiline, loc_translatable, israw=True ) ) return (xline, _nextstate) @@ -249,7 +249,7 @@ def run(self, xline, lineno, match): xline = xline [ match.end(): ] pywmlx.state.machine._pending_wmlstring = ( pywmlx.state.machine.PendingWmlString( - lineno, match.group(2), loc_multiline, loc_translatable + lineno, match.group(2), loc_multiline, loc_translatable, israw=False ) ) return (xline, _nextstate)