Closed
Bug 779790
Opened 12 years ago
Closed 7 years ago
Define default/fallback locale to use if a key is missing
Categories
(Add-on SDK Graveyard :: General, defect, P2)
Add-on SDK Graveyard
General
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: ochameau, Unassigned)
Details
For now, all locale are equals. There is not default, nor any locale being defined as the one to fallback to if a key is missing.
That's not an issue if you use gettext pattern, with keys being a string in a given language. This given language will be the default fallback one.
But if you use key as id, it starts to be important to have such fallback. It would avoid printing a key ID like "panel.title" if current locale doesn't have this key translated, whereas some main locale file maintained by addon developer has a human readable value in a different language.
Reporter | ||
Comment 1•12 years ago
|
||
In order to do that, we may want to add/support a new attribute in package.json,
something like:
{
"default-locale": "en-US"
}
Priority: -- → P2
In one of my add-ons each context menu item has a preference and labels of context menu items are identical to titles of their preferences. So it's logical to use preferences' locale identifiers for localizing the corresponding labels.
I'm just confirming that strings used for gettext shouldn't be considered as fallback.
I think "default-locale" attribute is a good solution. But will it be necessary to set a title for preferences if "default-locale" is set?
Comment 3•10 years ago
|
||
Irakli what do you think of this this? does it look good? I think it might be worthwhile.
Flags: needinfo?(rFobic)
Comment 4•10 years ago
|
||
Sure that sounds good. Ochameau does such thing exists for firefox apps ? Ideally we would follow it closely.
Flags: needinfo?(rFobic) → needinfo?(poirot.alex)
Reporter | ||
Comment 5•10 years ago
|
||
Yes, and I explicitely avoided to implement this feature (it wasn't a miss) as discussion were still happenning on the FxOS l10n side on how to implement this.
It ends up being significantly different and more complex as well as way more powerful for localizers.
See this naive example:
https://github.com/mozilla-b2g/gaia/blob/master/apps/calendar/locales/calendar.en-US.properties#L113
And more complex with two vars:
https://github.com/mozilla-b2g/gaia/blob/master/apps/communications/contacts/locales/contacts.en-US.properties#L107
Flags: needinfo?(poirot.alex)
Comment 6•7 years ago
|
||
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•