From 8cc562f87a8c50032067b378b6e4581406623c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20J=C3=BCrgens?= Date: Sun, 6 Oct 2024 15:58:48 +0200 Subject: [PATCH] Fix l10n folder structure --- assets/mozconfig.new | 2 +- assets/mozconfig.new.without-bootstrap | 2 +- scripts/librewolf-patches.py | 20 +++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/assets/mozconfig.new b/assets/mozconfig.new index 2bee00b..605fb52 100644 --- a/assets/mozconfig.new +++ b/assets/mozconfig.new @@ -17,7 +17,7 @@ ac_add_options --with-branding=browser/branding/librewolf ac_add_options --with-unsigned-addon-scopes=app,system -ac_add_options --with-l10n-base=$PWD/browser/locales +ac_add_options --with-l10n-base=$PWD/lw/l10n ac_add_options --enable-bootstrap diff --git a/assets/mozconfig.new.without-bootstrap b/assets/mozconfig.new.without-bootstrap index 95c6a53..59c5e81 100644 --- a/assets/mozconfig.new.without-bootstrap +++ b/assets/mozconfig.new.without-bootstrap @@ -18,7 +18,7 @@ ac_add_options --with-branding=browser/branding/librewolf ac_add_options --with-unsigned-addon-scopes=app,system -ac_add_options --with-l10n-base=$PWD/browser/locales/l10n +ac_add_options --with-l10n-base=$PWD/lw/l10n export MOZ_REQUIRE_SIGNING= diff --git a/scripts/librewolf-patches.py b/scripts/librewolf-patches.py index e68690d..364c1e0 100755 --- a/scripts/librewolf-patches.py +++ b/scripts/librewolf-patches.py @@ -151,11 +151,11 @@ def librewolf_patches(): with TemporaryDirectory() as tmpdir: exec(f"wget -qO {tmpdir}/l10n.zip 'https://codeload.github.com/mozilla-l10n/firefox-l10n/zip/refs/heads/main'") exec(f"unzip -qo {tmpdir}/l10n.zip -d {tmpdir}/l10n") - exec(f"mv {tmpdir}/l10n/firefox-l10n-main/* browser/locales") + exec(f"mv {tmpdir}/l10n/firefox-l10n-main lw/l10n") print("-> Patching appstrings.properties") # Why is "Firefox" hardcoded there??? - exec("find browser/locales -path '*/appstrings.properties' -exec sed -i s/Firefox/LibreWolf/ {} \;") + exec("find . -path '*/appstrings.properties' -exec sed -i s/Firefox/LibreWolf/ {} \;") print("-> Applying LibreWolf locales") l10n_dir = Path("..", "l10n") @@ -164,11 +164,17 @@ def librewolf_patches(): continue rel_path = source_path.relative_to(l10n_dir) - target_path = Path( - "browser", "locales", - rel_path.parts[0], - *([] if rel_path.parts[0] == "en-US" else ["browser"]) , - *rel_path.parts[1:]) + if rel_path.parts[0] == "en-US": + target_path = Path( + rel_path.parts[1], + "locales", "en-US", + *rel_path.parts[1:] + ) + else: + target_path = Path( + "lw", "l10n", + *rel_path.parts + ) target_path.parent.mkdir(parents=True, exist_ok=True) write_mode = "w"