|
@@ -24,7 +24,7 @@ from frappe.query_builder import Field, DocType |
|
|
from pypika.terms import PseudoColumn |
|
|
from pypika.terms import PseudoColumn |
|
|
|
|
|
|
|
|
TRANSLATE_PATTERN = re.compile( |
|
|
TRANSLATE_PATTERN = re.compile( |
|
|
r"_\(" # starts with literal `_(` work with both python / JS |
|
|
|
|
|
|
|
|
r"_\([\s\n]*" # starts with literal `_(`, ignore following whitespace/newlines |
|
|
|
|
|
|
|
|
# BEGIN: message search |
|
|
# BEGIN: message search |
|
|
r"([\"']{,3})" # start of message string identifier - allows: ', ", """, '''; 1st capture group |
|
|
r"([\"']{,3})" # start of message string identifier - allows: ', ", """, '''; 1st capture group |
|
@@ -33,7 +33,7 @@ TRANSLATE_PATTERN = re.compile( |
|
|
# END: message search |
|
|
# END: message search |
|
|
|
|
|
|
|
|
# BEGIN: python context search |
|
|
# BEGIN: python context search |
|
|
r"(\s*,\s*context\s*=\s*" # capture `context=` with ignoring whitespace |
|
|
|
|
|
|
|
|
r"([\s\n]*,[\s\n]*context\s*=\s*" # capture `context=` with ignoring whitespace |
|
|
r"([\"'])" # start of context string identifier; 5th capture group |
|
|
r"([\"'])" # start of context string identifier; 5th capture group |
|
|
r"(?P<py_context>((?!\5).)*)" # capture context string till closing id is found |
|
|
r"(?P<py_context>((?!\5).)*)" # capture context string till closing id is found |
|
|
r"\5" # match context string closure |
|
|
r"\5" # match context string closure |
|
@@ -49,7 +49,7 @@ TRANSLATE_PATTERN = re.compile( |
|
|
r")*" # match one or more context string |
|
|
r")*" # match one or more context string |
|
|
# END: JS context search |
|
|
# END: JS context search |
|
|
|
|
|
|
|
|
r"\)" # Closing function call |
|
|
|
|
|
|
|
|
r"[\s\n]*\)" # Closing function call ignore leading whitespace/newlines |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|