From 5ddfdaa953645c286b3ae53627f764cd571bbf94 Mon Sep 17 00:00:00 2001 From: metasmile Date: Thu, 20 Sep 2018 14:57:15 +0200 Subject: [PATCH] add replacement regex for property "%{appName}" (support for intentdefinition localization for iOS 12) --- strsync/strsync_playground.py | 7 +++++-- strsync/strtrans.py | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/strsync/strsync_playground.py b/strsync/strsync_playground.py index edd3837..27eaf44 100644 --- a/strsync/strsync_playground.py +++ b/strsync/strsync_playground.py @@ -38,6 +38,7 @@ %10c%5hc%5C%5lc The temp is %.*f %ss%lii +${replacement} %*.*s | %.3d | %lC | %s%%%02d''' cfmt='''\ @@ -49,8 +50,10 @@ (?:\.(?:\d+|\*))? # precision (?:h|l|ll|w|I|I32|I64)? # size [cCdiouxXeEfgGaAnpsSZ@] # type -) | # OR -%%) # literal "%%" +) # OR +| \$\{.+\} # replacement for property "%{appName}" +| %% # literal "%%" +) ''' for line in lines.splitlines(): diff --git a/strsync/strtrans.py b/strsync/strtrans.py index eb340be..08b37e5 100644 --- a/strsync/strtrans.py +++ b/strsync/strtrans.py @@ -13,8 +13,10 @@ (?:\.(?:\d+|\*))? # precision (?:h|l|ll|w|I|I32|I64)? # size [cCdiouxXeEfgGaAnpsSZ@] # type - ) | # OR - %%) # literal "%%" + ) # OR + | \$\{.+\} # replacement for property "%{appName}" + | %% # literal "%%" + ) ''' __LITERNAL_FORMAT_RE__ = re.compile(__LITERAL_REGEX__, flags=re.X)