[tbb-commits] [Git][tpo/applications/tor-browser-build][main] Bug 41143: Add Firefox's localization files also to GeckoView.

Pier Angelo Vendrame (@pierov) git at gitlab.torproject.org
Wed May 15 08:19:29 UTC 2024



Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build


Commits:
84219469 by Pier Angelo Vendrame at 2024-05-15T10:19:02+02:00
Bug 41143: Add Firefox's localization files also to GeckoView.

They are needed for formatting APIs to work as expected.

- - - - -


3 changed files:

- projects/firefox-l10n/config
- projects/geckoview/config
- projects/geckoview/merge_aars


Changes:

=====================================
projects/firefox-l10n/config
=====================================
@@ -21,11 +21,17 @@ steps:
     input_files => sub {
       my ($project, $options) = @_;
       my @input_files;
-      my $changesets_json = project_config('firefox', 'var/l10n-changesets', { %$options, origin_project => $project });
+      my $is_android = project_config($project, 'var/android', $options);
+      my $source_project = $is_android ? 'geckoview' : 'firefox';
+      my $locales_key = $is_android ? 'var/locales_mobile' : 'var/locales';
+      my $changesets_json = project_config($source_project, 'var/l10n-changesets', { %$options, origin_project => $project });
       my $d = decode_json $changesets_json;
-      my $locales = project_config($project, 'var/locales', $options);
+      my $locales = project_config($project, $locales_key, $options);
       foreach my $loc (@$locales) {
         my $locale = process_template($project, $loc, '.');
+        $locale =~ s/-r/-/;
+        $locale = "id" if ($is_android && $locale eq "in");
+        $locale = "he" if ($is_android && $locale eq "iw");
         next unless my $revision = $d->{$locale}{revision};
         my $input_file = {
           name => $locale,


=====================================
projects/geckoview/config
=====================================
@@ -33,6 +33,8 @@ var:
   gradle_dependencies_version: 12
   gradle_version: 7.5.1
   variant: beta
+  has_l10n: '[% !c("var/testbuild") && !c("var/locales").empty %]'
+  l10n-changesets: '[% exec("cat browser/locales/l10n-changesets.json") %]'
 
 targets:
   release:
@@ -84,6 +86,12 @@ steps:
         pkg_type: build
         target_prepend:
           - torbrowser-android-x86_64
+      - project: firefox-l10n
+        name: firefox-l10n
+        enable: '[% c("var/has_l10n") %]'
+        pkg_type: build
+        target_prepend:
+          - torbrowser-android-armv7
 
   list_toolchain_updates:
     git_url: https://github.com/mozilla/gecko-dev.git


=====================================
projects/geckoview/merge_aars
=====================================
@@ -49,6 +49,19 @@ cp -rl $gradle_repo/maven2/* $gradle_repo || true
 export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
 # Create .mozbuild to avoid interactive prompt in configure
 mkdir "$HOME/.mozbuild"
+
+[% IF c("var/has_l10n") -%]
+  supported_locales="[% tmpl(c('var/locales_mobile').join(' ')).replace('-r', '-').replace('in', 'id').replace('iw', 'he') %]"
+  l10ncentral="$HOME/.mozbuild/l10n-central"
+  mkdir "$l10ncentral"
+  for tarball in $rootdir/[% c('input_files_by_name/firefox-l10n') %]/*; do
+    tar -C "$l10ncentral" -xf "$tarball"
+  done
+
+  # Do not setup our localization files, as we do not provide any frontend
+  # through GeckoView.
+[% END -%]
+
 # We still need to specify --tor-browser-version due to bug 34005.
 ./mach configure \
   --with-base-browser-version=[% c("var/torbrowser_version") %] \
@@ -56,6 +69,12 @@ mkdir "$HOME/.mozbuild"
   [% IF !c("var/rlbox") -%]--without-wasm-sandboxed-libraries[% END %]
 
 ./mach build --verbose
+
+[% IF c('var/has_l10n') -%]
+  # No quotes on purpose, to pass each locale as an additional argument.
+  ./mach package-multi-locale --locales en-US $supported_locales
+[% END -%]
+
 # We prepare an archive to then extract it as we were using a local Maven
 # repository.
 # See also https://github.com/mozilla-mobile/firefox-android/blob/main/fenix/docs/substituting-local-gv.md



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/842194699e8b25c03bb2ed6565365e2bd8eada76

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/842194699e8b25c03bb2ed6565365e2bd8eada76
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240515/c2d5f573/attachment-0001.htm>


More information about the tbb-commits mailing list