Closed Bug 1125177 Opened 9 years ago Closed 9 years ago

Amend ctx.availableLocales when additionallanguageschange event is fired

Categories

(Firefox OS Graveyard :: Gaia::L10n, defect)

defect
Not set
normal

Tracking

(b2g-v2.2 fixed, b2g-master fixed)

RESOLVED FIXED
2.2 S5 (6feb)
Tracking Status
b2g-v2.2 --- fixed
b2g-master --- fixed

People

(Reporter: stas, Assigned: stas)

Details

Attachments

(1 file)

There's one thing that we missed in bug 1115796:  when a langpack is installed and the user chooses the newly installed languages as their system language, we need to amend ctx.availableLocales in already running apps so that the language negotiation correctly returns the new language.
Here's one way to fix this:

https://github.com/mozilla-b2g/gaia/pull/27634
Assignee: nobody → stas
Status: NEW → ASSIGNED
Attachment #8553775 - Flags: review?(gandalf)
Fabrice,  a quick question about the additionallanguageschange event:  I might be reading the code wrong, but I looked at

  https://hg.mozilla.org/integration/b2g-inbound/diff/df960e299bcd/dom/apps/Langpacks.jsm#l1.2449

and then tried to access the 'languages' property of the event which turned out to be undefined.  The only property of the event that I can see in a handler is 'isTrusted.'  Is there a way to get the updated list of additional languages from the additionallanguageschange event?

In the patch I currently need to make another mozApps.getAdditionalLanguages() call to get the new list.
Flags: needinfo?(fabrice)
Stas, you should get it from the event.detail property.
Flags: needinfo?(fabrice)
Comment on attachment 8553775 [details] [diff] [review]
Listen to additionallanguageschange

Review of attachment 8553775 [details] [diff] [review]:
-----------------------------------------------------------------

I like the patch. I'd like it more with event.detail ;)
Attachment #8553775 - Flags: review?(gandalf) → review+
Master: https://github.com/mozilla-b2g/gaia/commit/86f65f8c1a1f26fdf4252750f28afe068b4ece49
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Comment on attachment 8553775 [details] [diff] [review]
Listen to additionallanguageschange

[Approval Request Comment]

[Bug caused by] (feature/regressing bug #):  bug 1115796

[User impact] if declined:  when a new langpack is installed and selected as the system language, currently open apps will not retranslate immediately.  Subsequent launches will be in the correct language.

[Testing completed]: on the device

[Risk to taking this patch] (and alternatives if risky):  low risk, the code adds an event listener.

[String changes made]: n/a
Attachment #8553775 - Flags: approval-gaia-v2.2?(bbajaj)
Attachment #8553775 - Flags: approval-gaia-v2.2?(bbajaj) → approval-gaia-v2.2+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: