Fennec is shipped with multi-locale support. Under the Settings menu option, General -> Language -> Browser Language there are tens of languages and locales available. How are these included and shipped?
Designs
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
Okay. So, there's a doc for this. Specifically, the mozilla build system clones l10n-central and creates the localization package from there. I haven't look at the logic used for this, yet.
We'll want to clone l10n-central separately, and add the location into .mozconfig-android:
You should find a re-packaged build at ``OBJDIR/dist/``, and arunnable binary in ``OBJDIR/dist/l10n-stage/``.
Running the installers- build target (by default):
The ``installers`` target runs quite a few things for you, including gettingthe repository for the requested locale fromhttps://hg.mozilla.org/l10n-central/. It will clone them into``~/.mozbuild/l10n-central``.
Multilocale packages are created using:
export MOZ_CHROME_MULTILOCALE="de it zh-TW" for AB_CD in $MOZ_CHROME_MULTILOCALE; do ./mach build chrome-$AB_CD done AB_CD=multi ./mach package
This sounds like the mechanism we eventually want to use for getting rid of our bundle-language-packs-approach. So, we want that for legacy/trac#26465 (moved) as well which makes me think we should keep desktop in mind once we file follow-up bugs to implement the things we learned from the investigation in this ticket.
FWIW: I plan to work on the repack idea for desktop in legacy/trac#27466 (moved) and might think about how to integrate the multi-locale support for Tor Browser on Android into our build system while I am at it.
This results in a localized apk. There is an inconsistency when built with legacy/trac#28051 (moved) because Orbot doesn't learn about the new locale until later, but we can correct that. Overall, Fennec, torbutton, and Orbot use the correct localized strings.
Okay. comment:7 is correct, but this becomes more complicated with Orbot. When we build a single-locale package, it replaces the localizable strings - meaning each English string that is localized is replaced with the localized string, so the English string is not available within the app. This is good - but it becomes more confusing.
Because all the English strings are substituted with localized strings, the user cannot choose between the localized string and the English strings. This usually wouldn't be a problem, except within Fennec's preferences menu "English (United States)" is always shown. It seems Mozilla thought it important to hard-code "en-US" as an option, even when it is not really available. sigh. But that is relatively easy to fix.
The difficulty comes when Orbot is added into the app. The single-locale re-package process only replaces the Fennec strings, it doesn't touch the Orbot strings, so Orbot uses the system default locale when it starts. This isn't a problem if the user downloaded Tor Browser for the same locale as their system, but if the user has (as an example) en-US as their system default locale but downloads the es-ES localized Tor Browser, then it becomes weird. In this situation, Orbot shows everything in English and Tor Browser shows everything in es-ES. Orbot allows the user switch their locale, but this is confusing.
I think we should add a mechanism within Orbot so it automatically chooses the correct locale when it starts. We can likely add this in the logic when Tor Browser runs Orbot the first time. I prefer having the user control their locale on the Tor Browser-side of the app, rather than the Orbot-side - but others can change my mind :)
I built a multi-locale package, including the 28 locales provided by the desktop alpha builds. It is as simple as the documentation says. The trick is you must do it exactly as the doc says, and don't change the name of the environment variable it says :) (specifically, MOZ_CHROME_MULTILOCALE must be used and set correctly)
Follow the same steps as comment:7, except substitute the last step (./mach build installers-es-ES) with the following three steps:
$ export MOZ_CHROME_MULTILOCALE="ar ca cs da de el es-ES fa fr ga-IE he hu id is it ja ka ko nb-NO nl pl pt-BR ru sv-SE tr vi zh-CN zh-TW"$ for AB_CD in $MOZ_CHROME_MULTILOCALE; do ./mach build chrome-$AB_CD;done$ AB_CD=multi ./mach package
The resulting apk is ~48MB, including Orbot and the addons. The filename contains en-US:
$ # before$ du -sh ~/tor-browser/obj-x86-linux-android/dist/fennec-60.3.0.en-US.android-i686.apk46M /home/android/tor-browser/obj-x86-linux-android/dist/fennec-60.3.0.en-US.android-i686.apk$ # after$ du -sh ~/tor-browser/obj-x86-linux-android/dist/fennec-60.3.0.en-US.android-i686.apk48M /home/android/tor-browser/obj-x86-linux-android/dist/fennec-60.3.0.en-US.android-i686.apk
Comparing the mutli-locale package with the single-locale package, the multi-locale package provides a better user experience. Orbot and Fennec use the system default locale on first-run, so they should use the same locale when the user opens the app. When a different locale is chosen within Fennec, Orbot uses the new locale, too. It seems like this mitigates the major problems in the single-locale package.
Looks mostly good, thanks. One thing we should fix:
{{{
exite_error("Error reading $file", 2) unless defined $json_text;
}}}
There is no exite_error function.
Looks mostly good, thanks. One thing we should fix:
{{{
exite_error("Error reading $file", 2) unless defined $json_text;
}}}
There is no exite_error function.
Compared to bug_26843_v5 it is rebased on the latest master and contains an indication in the bundle name that the .apk is actually not a single-locale one, using "multi" as Mozilla does.
Compared to bug_26843_v5 it is rebased on the latest master and contains an indication in the bundle name that the .apk is actually not a single-locale one, using "multi" as Mozilla does.
It seems that when we are running AB_CD=multi ./mach package, the variable MOZ_CHROME_MULTILOCALE contains all the locales we want. However, when we run ./mach build chrome-[% lang %], only the current and previous locales are included in MOZ_CHROME_MULTILOCALE. Is ./mach build chrome-[% lang %] ignoring the variable MOZ_CHROME_MULTILOCALE (and in this case it doesn't matter if it doesn't contain all the locales), or should we add all the locales before running the first ./mach build chrome-[% lang %]?
We could use this line to set all the locales in MOZ_CHROME_MULTILOCALE:
An other minor thing: I think it would be better to extract the locales in a sub-directory (such as /var/tmp/dist/locales) instead of directly in /var/tmp/dist.
Trac: Status: needs_review to needs_revision Keywords: TorBrowserTeam201812R deleted, TorBrowserTeam201812 added
Compared to bug_26843_v5 it is rebased on the latest master and contains an indication in the bundle name that the .apk is actually not a single-locale one, using "multi" as Mozilla does.
It seems that when we are running AB_CD=multi ./mach package, the variable MOZ_CHROME_MULTILOCALE contains all the locales we want. However, when we run ./mach build chrome-[% lang %], only the current and previous locales are included in MOZ_CHROME_MULTILOCALE. Is ./mach build chrome-[% lang %] ignoring the variable MOZ_CHROME_MULTILOCALE (and in this case it doesn't matter if it doesn't contain all the locales), or should we add all the locales before running the first ./mach build chrome-[% lang %]?
Yeah, ./mach build is ignoring it. But ./mach package needs it. I used the FOREACH loop to populate the env variable while cycling through the locales anyway.
We could use this line to set all the locales in MOZ_CHROME_MULTILOCALE:
{{{
export MOZ_CHROME_MULTILOCALE='[% tmpl(c('var/locales').join(' ')) %]'
}}}
That's probably better, yes. I'll take that approach instead of my clumsy one.
An other minor thing: I think it would be better to extract the locales in a sub-directory (such as /var/tmp/dist/locales) instead of directly in /var/tmp/dist.
Hm, so the new product details URL for 60.4.0esr should be https://product-details.mozilla.org/1.0/l10n/Firefox-60.4.0esr-build2.json but it is not available despite build2 is already done. We should not merge this patch before we can be sure the new product details are available once we start building.
To get the json file we use the exec() function, which will checkout the git_hash commit and run the command from there.
You used cat browser/locales/l10n-changesets.json but we should take the .json file for now from the mobile directory as the l10n repos and revisions are used for Android only at the moment. Thus, cat mobile/locales/l10n-changesets.json. Otherwise this looks reasonable. I still need to test it, though.
Trac: Keywords: TorBrowserTeam201812R deleted, TorBrowserTeam201812 added Status: needs_review to needs_revision
This patch looks good to me. I did not merge it yet as the json file for 60.4.0 is not available yet.
We have a clear way forward (see previous comments). Thus, taking this patch now (commit 524a9364ead98593507f8f881cc1aa9764945324 on master) as it does not break anything until we bump the esr60 tor-browser branch.
To get the json file we use the exec() function, which will checkout the git_hash commit and run the command from there.
You used cat browser/locales/l10n-changesets.json but we should take the .json file for now from the mobile directory as the l10n repos and revisions are used for Android only at the moment. Thus, cat mobile/locales/l10n-changesets.json. Otherwise this looks reasonable. I still need to test it, though.
Alright, that seems to work. I compared the mobile/locales/ and the browser/locales/ l10n-changesets.json and it seems they differ a bit. Looking at https://product-details.mozilla.org/1.0/l10n/Firefox-60.3.0esr-build1.json it seems that one mirrors the file in browser/locales. Thus, as we ship for mobile I think it is good to use the one on mobile/locales instead.
To save a roundtrip I've made that small change in the patch myself. The result is commit bad46e532fa614ffdd3ed0e21f4b8fae3ba7793d on master.
Trac: Status: needs_revision to closed Resolution: N/Ato fixed