summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorJonatan Rhodin <jonatan.rhodin@mullvad.net>2025-06-30 08:46:34 +0200
committerJonatan Rhodin <jonatan.rhodin@mullvad.net>2025-06-30 10:19:19 +0200
commita7392d782fcd6116d7b4e52143dccbb86dd960d3 (patch)
tree798b718bad867b95dafaa35309937d90eb3d1639 /android
parent8fa1cde80e49951ed187a2c87bceecd887150f89 (diff)
downloadmullvadvpn-a7392d782fcd6116d7b4e52143dccbb86dd960d3.tar.xz
mullvadvpn-a7392d782fcd6116d7b4e52143dccbb86dd960d3.zip
Fix issue with normalization in the translation script
Diffstat (limited to 'android')
-rw-r--r--android/translations-converter/src/normalize.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/android/translations-converter/src/normalize.rs b/android/translations-converter/src/normalize.rs
index 20a2bce754..d3e5227d2c 100644
--- a/android/translations-converter/src/normalize.rs
+++ b/android/translations-converter/src/normalize.rs
@@ -49,12 +49,16 @@ mod gettext {
static ESCAPED_SINGLE_QUOTES: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\\'").unwrap());
static ESCAPED_DOUBLE_QUOTES: LazyLock<Regex> = LazyLock::new(|| Regex::new(r#"\\""#).unwrap());
- static PARAMETERS: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"%\([^)]*\)").unwrap());
+ // Look for both %(...) and %(1-9)$(...) as we now push the latter to the common translation file
+ static NAMED_PARAMETERS: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"%\([^)]*\)").unwrap());
+ static ORDERED_PARAMETERS: LazyLock<Regex> =
+ LazyLock::new(|| Regex::new(r"%[0-9]*\$").unwrap());
impl Normalize for MsgString {
fn normalize(&self) -> String {
// Mark where parameters are positioned, removing the parameter name
- let string = PARAMETERS.replace_all(self, "%");
+ let string = NAMED_PARAMETERS.replace_all(self, "%");
+ let string = ORDERED_PARAMETERS.replace_all(&string, "%");
// Remove escaped single-quotes
let string = ESCAPED_SINGLE_QUOTES.replace_all(&string, r"'");
// Remove escaped double-quotes