Closed
Bug 880603
Opened 13 years ago
Closed 9 years ago
Add possibility to change the locale used by l10n
Categories
(Add-on SDK Graveyard :: Documentation, defect, P3)
Add-on SDK Graveyard
Documentation
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: santiago.gimeno, Unassigned)
References
Details
At the moment is quite complicated. From a chat with @erikvold:
<sgimeno> hello, Is it possible to change the locale used by the l10n module dynamically? I've tried setting intl.locale.matchOS preference to false and pref_services.setLocalized('general.useragent.locale', 'es') with no luck. It uses the default: 'en-US'
<@erikvold> sgimeno: like this: https://github.com/mozilla/addon-sdk/blob/master/test/addons/l10n/main.js#L29-L58
<@erikvold> custom loader
<sgimeno> erikvold: I see. Thanks a lot! :D
<@erikvold> hmm actually that seems to just change some prefs before making a loader
<@erikvold> maybe the latter isn't necessary, but that would change the whole browser's default
<@erikvold> ahh I see yiy tried that now
<@erikvold> you*
<@erikvold> I see
<@erikvold> the 'best' locales are deteremined with the l10n modules load
<@erikvold> so you can change those prefs
<@erikvold> make a new loader
<@erikvold> then change them back immediately
<@erikvold> and use the new loader
Priority: -- → P3
It might be nice to drop a note in the documentation about how to set a locale to test your addon. There is nothing there at present.
Comment 2•12 years ago
|
||
So it looks like one can change the default locale by resetting these two prefs https://github.com/mozilla/addon-sdk/blob/master/test/addons/l10n/main.js#L11-L12 ( `general.useragent.locale` and `intl.locale.matchOS`).
Then disable/enable the add-on to see the locale change.
I'll change this to be a documentation bug.
Component: General → Documentation
Updated•12 years ago
|
OS: Linux → All
Hardware: x86 → All
Comment 3•9 years ago
|
||
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•