Last Comment Bug 713464 - English labels displayed initially on multilanguage apk instead of localized strings
: English labels displayed initially on multilanguage apk instead of localized ...
Status: RESOLVED FIXED
:
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: Trunk
: ARM Android
: P3 normal (vote)
: Firefox 12
Assigned To: Sriram Ramasubramanian [:sriram]
:
Mentors:
: 717533 (view as bug list)
Depends on: 757442
Blocks: 697384
  Show dependency treegraph
 
Reported: 2011-12-25 12:04 PST by Francesco Lodolo [:flod] - OFFLINE Jun 26-Jul 3
Modified: 2012-05-30 07:33 PDT (History)
12 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
fixed
beta+
11+


Attachments
Screenshot of the initial menu partially localized (84.91 KB, image/png)
2011-12-25 12:04 PST, Francesco Lodolo [:flod] - OFFLINE Jun 26-Jul 3
no flags Details
about:home screenshot on Aurora (114.79 KB, image/jpeg)
2012-01-16 22:25 PST, Francesco Lodolo [:flod] - OFFLINE Jun 26-Jul 3
no flags Details
Patch (2.51 KB, patch)
2012-01-30 19:39 PST, Sriram Ramasubramanian [:sriram]
mark.finkle: review+
akeybl: approval‑mozilla‑aurora+
akeybl: approval‑mozilla‑beta+
Details | Diff | Review

Description Francesco Lodolo [:flod] - OFFLINE Jun 26-Jul 3 2011-12-25 12:04:11 PST
Created attachment 584285 [details]
Screenshot of the initial menu partially localized

Just installed the latest build on Asus EeePad: Mozilla/5.0 (Android; Linux armv7l; rv:12.0a1) Gecko/20111225 Firefox/12.0a1 Fennec/12.0a1.

The first time you start the browser, some strings in the top right menu are in English:
* Bookmark or Remove (checkbox)
* Request Desktop Site

If I open "Impostazioni" (Settings) I get all strings in English, same thing if I try to use "Elimina impostazioni sito" (Clear Site Settings).

It's enough to rotate the screen to see all localized strings as expected.

The only things that remain in English are:
* the whole start page's content (Top Sites, etc.)
* Request Desktop Site/Request Mobile Site

About the second string I searched mxr but I can't find any evident explanation
http://mxr.mozilla.org/mozilla-central/search?string=agent_request_desktop&find=mobile
Comment 1 Francesco Lodolo [:flod] - OFFLINE Jun 26-Jul 3 2011-12-25 12:25:06 PST
Similar behavior on Samsung Galaxy S II with 2.3.3, so not just related to HoneyComb.

In this case the number of strings that always remain in English after a screen rotation is bigger: only "Bookmark" and "Other" are translated, menu displayed pressing "Other" is completely in English.
Comment 2 Francesco Lodolo [:flod] - OFFLINE Jun 26-Jul 3 2011-12-26 04:09:28 PST
With 20111226 build "Request Desktop Site" is displayed localized, usually it changes after you create a new tab or switch to a different one.

Also all buttons on my Samsung Galaxy S II with 2.2.3 are localized after a screen rotation.

The only problem standing is the one described in the summary: initially Firefox is a mix of English and localized strings.
Comment 3 Mark Finkle (:mfinkle) (use needinfo?) 2011-12-29 12:23:01 PST
Sriram - Is this an inflation issue? Maybe something is racing?
Comment 4 Guillermo López :willyaranda (probably SLOW response) 2012-01-04 09:29:28 PST
Having the same problem for es-ES (tested both HTC Desire and Xperia Neo V, GB). Is there any chance this bug gets attention in a near future? I cannot test my translation properly, and I'd love to do it in the early stages of aurora cycle.
Comment 5 Axel Hecht [:Pike] 2012-01-04 09:47:00 PST
Stas, can you confirm this?
Comment 6 Alexander L. Slovesnik 2012-01-04 10:31:25 PST
I can confirm this bug for Russian locale on HTC Desire with CyanogenMod 7.1.0 installed.
Comment 7 Francesco Lodolo [:flod] - OFFLINE Jun 26-Jul 3 2012-01-05 02:42:59 PST
(In reply to Guillermo López (:willyaranda) from comment #4)
> I cannot test my translation properly, and I'd love to do it in the early 
> stages of aurora cycle.
Rotating the screen doesn't work for you?
Comment 8 Axel Hecht [:Pike] 2012-01-05 02:45:36 PST
Also, if you can reproduce it, and look at adb logcat for anything surprising?
Comment 9 Guillermo López :willyaranda (probably SLOW response) 2012-01-05 08:30:28 PST
(In reply to flod (Francesco Lodolo) from comment #7)
> (In reply to Guillermo López (:willyaranda) from comment #4)
> > I cannot test my translation properly, and I'd love to do it in the early 
> > stages of aurora cycle.
> Rotating the screen doesn't work for you?

nope, menu pop-up stays in a mixed state (everything except "Bookmarks" ("Marcadores") in English if I rotate.

But in the Settings menu, rotation changes the language to es-ES.

(In reply to Axel Hecht [:Pike] from comment #8)
> Also, if you can reproduce it, and look at adb logcat for anything
> surprising?

Anything suspicious, no ERRORs in GeckoApp or related.
Comment 10 Guillermo López :willyaranda (probably SLOW response) 2012-01-05 08:33:05 PST
Well, if I rotate a few times the phone, it *maybe* change the language. Now I've seen everything translated in menu pop-up except "Bookmarks" (so inverted from my previous comments).

But still, not working with a simple rotation.
Comment 11 Axel Hecht [:Pike] 2012-01-12 05:53:14 PST
*** Bug 717533 has been marked as a duplicate of this bug. ***
Comment 12 Guillermo López :willyaranda (probably SLOW response) 2012-01-13 15:18:48 PST
I know this is bugspam, but I just read the announcement in dev.l10n by Jeff about localizing Fennec11 (Native) and I think this bug should be fixed ASAP (or at least before transplanting aurora->beta if beta will go to the market as usual).

I can't test my language properly (I can blindly test comparing with en-US, but this is not ideal) and I've found a few string that doesn't fit in the screen and I needed to shorten them.
Comment 13 Mark Finkle (:mfinkle) (use needinfo?) 2012-01-13 19:55:57 PST
If this bug only truly affects multilanguage APKs, then we could use the new single language APKs to test languages:

http://ftp.mozilla.org/pub/mozilla.org/mobile/nightly/latest-mozilla-aurora-android-l10n/
Comment 14 Guillermo López :willyaranda (probably SLOW response) 2012-01-14 08:02:29 PST
(In reply to Mark Finkle (:mfinkle) from comment #13)
> If this bug only truly affects multilanguage APKs, then we could use the new
> single language APKs to test languages:
> 
> http://ftp.mozilla.org/pub/mozilla.org/mobile/nightly/latest-mozilla-aurora-
> android-l10n/

Ok, thanks for pointing this to me. Anyway, are you going to ship multilocale builds for Firefox for Android in the market? Or just single locales depending on the location provided by the Market?

Thanks!
Comment 15 Axel Hecht [:Pike] 2012-01-14 08:42:29 PST
We'll need the multi-apk for the amazon market, so we can't really ignore this bug.
Comment 16 Francesco Lodolo [:flod] - OFFLINE Jun 26-Jul 3 2012-01-16 22:25:25 PST
Created attachment 589108 [details]
about:home screenshot on Aurora

Still not clear to me (I asked in the first comment): about:home is supposed to be in English or localized?

Take for example "Top Sites": it's localized in my repository but still displayed in English in the build, the rotation trick doesn't work here.
http://mxr.mozilla.org/l10n-mozilla-aurora/source/it/mobile/android/base/android_strings.dtd#4

Even if we're going to ship single locale builds, I think it would be useful to give this bug a clear priority.
Comment 17 Mark Finkle (:mfinkle) (use needinfo?) 2012-01-16 23:12:35 PST
(In reply to flod (Francesco Lodolo) from comment #16)
> Created attachment 589108 [details]
> about:home screenshot on Aurora
> 
> Still not clear to me (I asked in the first comment): about:home is supposed
> to be in English or localized?
> 
> Take for example "Top Sites": it's localized in my repository but still
> displayed in English in the build, the rotation trick doesn't work here.
> http://mxr.mozilla.org/l10n-mozilla-aurora/source/it/mobile/android/base/
> android_strings.dtd#4

Should be fixed by bug 712970
Comment 18 Sriram Ramasubramanian [:sriram] 2012-01-27 13:34:56 PST
Since I'm unable to make multi-locale builds, I couldn't try testing this.

From what I remember from initial code (from when the screenshots where taken):
1. Bookmarks had two different strings ("Bookmark" and "Remove") which were changed based on whether the site was bookmarked or not. This was changing in code in java. Now, only one string "Bookmark" is being used.
2. I am not sure about "Request Desktop site". But I don't find that menu anymore.

Now, when the value is changed in code, the android tries to get "localized" string always. In this case, the localized string would be from en-US as the device might have been running on English (US) phones. Note: This is device wide locale.

Android cannot get localized strings based on Fennec's language (as the device's locale is still different). Fennec should request it to be run on a different locale than the system's, so that Android can do it for us. However, our current code doesn't support this. We only have "one" strings.xml file in res/values/ -- which will be the default resource used.

I am not sure if multiple resource folders (of form ab-CD) are generated and placed inside res/values. If they aren't then changing strings cannot happen.

Still, from the screenshots, and the recent code changes to menu, I believe this problem wouldn't exist anymore.
Comment 19 Guillermo López :willyaranda (probably SLOW response) 2012-01-27 16:59:39 PST
http://ftp.mozilla.org/pub/mozilla.org/mobile/nightly/latest-mozilla-central-android/

I've tried latest nightly and the problem is still there. Sometimes English, sometimes Spanish…
Comment 20 Francesco Lodolo [:flod] - OFFLINE Jun 26-Jul 3 2012-01-27 21:38:05 PST
(In reply to Sriram Ramasubramanian [:sriram] from comment #18)
> Still, from the screenshots, and the recent code changes to menu, I believe
> this problem wouldn't exist anymore.

Wrong ;-)

Request Desktop site is gone, menus changed structure but the problem is still the same (ALL preferences and dialogs are displayed in English until you do a screen rotation, sometimes more than one).
Comment 21 Sriram Ramasubramanian [:sriram] 2012-01-30 10:04:25 PST
I could see the preferences start in English and change to the language after rotation. But the menus were working fine for me.
Comment 22 Sriram Ramasubramanian [:sriram] 2012-01-30 17:14:16 PST
I am unable to build a multi-locale clone. I tried setting the device language to French and loading the app (ideally getLocale() should return French, though resources will be in english).
Both for preferences and awesome-screen, when the activity first loads it says English. On rotation, it says French. I am unable to understand what is causing the issue for the same.

https://hg.mozilla.org/mozilla-central/file/tip/mobile/android/base/GeckoThread.java#l86 - This piece of code is confusing me. Does this set the locale to entire application or just the activity?
Comment 23 Sriram Ramasubramanian [:sriram] 2012-01-30 19:39:10 PST
Created attachment 592969 [details] [diff] [review]
Patch

Phew! Finally with Mark's help we found the issue :)
The "setSelectedLocale()" method is still called from Gecko side.
Earlier we had an option to run Firefox in a language other than system's language.
However, this is not supported as of now.
Gecko resets the locale to en-US by calling this function with an empty string.
This affects GeckoPreferences activity in multi-locale builds by making it start in en-US (as the locale is reset).
With this fix, fennec wouldn't have issues with multi-locales.
Comment 24 Mark Finkle (:mfinkle) (use needinfo?) 2012-01-30 19:47:46 PST
Comment on attachment 592969 [details] [diff] [review]
Patch

># HG changeset patch
># User Sriram Ramasubramanian <sriram@mozilla.com>
># Date 1327980911 28800
># Node ID 4fd7aa4c5622c199a0ac061122447eafddb956b0
># Parent  bfeeb813aef2dfe25a74343034664127d954b274
>Bug 713464: Application Locale should not be reset from CPP.
>
>diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java
>--- a/mobile/android/base/GeckoAppShell.java
>+++ b/mobile/android/base/GeckoAppShell.java
>@@ -1142,38 +1142,44 @@ public class GeckoAppShell
>         ConnectivityManager cm = (ConnectivityManager)
>             GeckoApp.mAppContext.getSystemService(Context.CONNECTIVITY_SERVICE);
>         if (cm.getActiveNetworkInfo() == null)
>             return false;
>         return true;
>     }
> 
>     public static void setSelectedLocale(String localeCode) {
>+        /* Bug 713464: This method is still called from Gecko side.
>+           Earlier we had an option to run Firefox in a language other than system's language.
>+           However, this is not supported as of now.
>+           Gecko resets the locale to en-US by calling this function with an empty string.
>+           This affects GeckoPreferences activity in multi-locale builds */
>+
>         /* We're not using this, not need to save it (see bug 635342)

Can you add a trailing */ at the end of this line?
Comment 25 Sriram Ramasubramanian [:sriram] 2012-01-30 20:02:00 PST
Pushed to inbound with required changes.
http://hg.mozilla.org/integration/mozilla-inbound/rev/a3358c5fa80a
Comment 26 Axel Hecht [:Pike] 2012-01-31 00:35:23 PST
Sweet.

Should there be a follow-up to comment out the locale setting code in https://hg.mozilla.org/mozilla-central/file/tip/mobile/android/base/GeckoThread.java#l86, too?
Comment 27 Ed Morley [:emorley] 2012-01-31 06:51:11 PST
https://hg.mozilla.org/mozilla-central/rev/a3358c5fa80a

Leaving open for comment 26.
Comment 28 Sriram Ramasubramanian [:sriram] 2012-01-31 10:12:39 PST
(In reply to Axel Hecht [:Pike] from comment #26)
> Sweet.
> 
> Should there be a follow-up to comment out the locale setting code in
> https://hg.mozilla.org/mozilla-central/file/tip/mobile/android/base/
> GeckoThread.java#l86, too?

The locale setting code in GeckoThread.java does not harm now. I would like to keep it as it is until we know for sure the multi-locales are working fine.
Comment 29 Sriram Ramasubramanian [:sriram] 2012-01-31 10:16:51 PST
Comment on attachment 592969 [details] [diff] [review]
Patch

[Approval Request Comment]
Regression caused by (bug #): Bug 635432

User impact if declined: 
Multi-locale builds will show Preferences screen in English and then change to system's locale on rotation. This will cause confusion to users.

Testing completed (on m-c, etc.): Landed on m-c on 01/31

Risk to taking this patch (and alternatives if risky): None. Gecko is aware of the locale that the device is in. We are just blocking it from overwriting the locale.

String changes made by this patch: None.
Comment 30 Brad Lassey [:blassey] (use needinfo?) 2012-01-31 11:31:34 PST
(In reply to Sriram Ramasubramanian [:sriram] from comment #18)
> Since I'm unable to make multi-locale builds, I couldn't try testing this.
why are you unable to make multi-locale builds?
Comment 31 Sriram Ramasubramanian [:sriram] 2012-01-31 11:35:39 PST
Somehow different locales aren't being packed when i build and do | make package |. Not sure what am i doing wrongly.
Comment 32 Brad Lassey [:blassey] (use needinfo?) 2012-01-31 12:27:01 PST
you need to re-pack for multilocale builds, using this script https://hg.mozilla.org/build/mozharness/file/62e67a176fec/scripts/multil10n.py
Comment 33 Axel Hecht [:Pike] 2012-01-31 14:04:29 PST
After the merge-%; chrome-% dance for a few locales, you call

make package MOZ_CHROME_MULTILOCALE="de fr pl it zu" AB_CD=multi
Comment 34 Alex Keybl [:akeybl] 2012-02-01 11:33:18 PST
Comment on attachment 592969 [details] [diff] [review]
Patch

[Triage Comment]
Approved for Aurora 12 and Beta 11.
Comment 35 Sriram Ramasubramanian [:sriram] 2012-02-01 14:50:35 PST
http://hg.mozilla.org/releases/mozilla-aurora/rev/a3358c5fa80a
Comment 36 Alex Keybl [:akeybl] 2012-02-02 12:37:34 PST
I believe this still needs to be fixed on Beta 11.
Comment 37 Brad Lassey [:blassey] (use needinfo?) 2012-02-02 12:56:14 PST
https://hg.mozilla.org/releases/mozilla-beta/rev/a08160d613a5
Comment 38 Tim Maks van den Broek [:mad_maks] 2012-02-03 05:47:28 PST
mozilla-aurora build 2012-02-03 nl confirmed fixed
Comment 39 Tim Maks van den Broek [:mad_maks] 2012-02-04 07:23:06 PST
sorry can not confirm it, i did not installed the multi version i noticed  today.
i can not find a aurora multi build.

Note You need to log in before you can comment on or make changes to this bug.