Labs/Jetpack/Reboot/JEP/113: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
<pre class="brush:js"> | <pre class="brush:js"> | ||
var ctx = l10n.Context() | |||
ctx.addReference('url://foo.l10n') | |||
var params = { | var params = { | ||
tabs = 1; | tabs = 1; | ||
} | } | ||
ctx.bindEntity('l10n_id1', params); | |||
// ... | |||
params['tabs'] = 7; // at this poin the entity value updates to a new value | |||
</pre> | |||
* other API bindings examples: | |||
<pre class="brush:js"> | |||
var ctx = l10n.Context() | var ctx = l10n.Context() | ||
ctx.addReference('url://foo.l10n') | ctx.addReference('url://foo.l10n') | ||
notification.show({'l10n_id': 'id1'}) | |||
contextMenu.add({ | |||
l10n_id: 'id2', | |||
action: function() {} | |||
}) | |||
</pre> | </pre> | ||
Revision as of 00:30, 6 February 2010
JEP 113 - Localization
- Champion: Zbigniew Braniecki - gandalf@mozilla.com
- Type: ?
- Bug Ticket:
- Status: ?
Proposal
Implement a set of API's allowing for jetpack localization
- bind example:
var ctx = l10n.Context() ctx.addReference('url://foo.l10n') var params = { tabs = 1; } ctx.bindEntity('l10n_id1', params); // ... params['tabs'] = 7; // at this poin the entity value updates to a new value
- other API bindings examples:
var ctx = l10n.Context() ctx.addReference('url://foo.l10n') notification.show({'l10n_id': 'id1'}) contextMenu.add({ l10n_id: 'id2', action: function() {} })
Key Issues
- Is L10n part of a core?
- How do we load/store files?
- Do we hook l10n into other API's or do we provide separate methods only?
- can we bind variables?
Dependencies & Requirements
- byte loading
- local urls
Internal Methods
API Methods
- addReference(url) - adds a l10n file for a locale
- getValue(l10n_id(, {params})) - loads an entity value
- bindEntity(l10n_id, params) - binds entity to a set of variables. Makes an entity value update when one of params changes
- setLocale(ab-CD) - switch locale
- more API may be hooked into other API's depending on what we want