Making Firefox OS available in as many languages as possible is part of Mozilla's mission to give users the freedom of choice and let them be in control of their online experience.
To this end, Zibi and I have implemented a prototype of user-installable language packages, or langpacks, which are downloaded to the device when the user requests them. Watch the short video below to see them in action.
How the prototype works
We started with a simple language package server in node.js which is periodically pinged by Firefox OS and returns the list of languages that the server has available for a given set of apps. This list is used to build the language choice menu in the Settings app. When the user selects a language which is not installed on the device, the server is queried again and the corresponding language resources are downloaded. Currently, only very basic version-checking is being done and we'd like to explore versioning of langpacks further in the next iteration.
Ideally, this would happen independently of the user's running any apps, in a background service. The list of additional languages available on the server would be synchronized periodically, and stored locally on the device. The Data Store API might be useful for making this data available to other apps.
Since there are no background services in Firefox OS yet, we implemented the prototype in every app. We're looking into Service Workers as potentially being the right solution to extracting this logic into a single component.
Lastly, langpacks currently comprise of translation files only, and don't provide additional keyboard layouts (although the Keyboard IME API should make this possible), nor do they change the translated names of apps which are stored in webapp manifests.
Why langpacks are important
Langpacks have a number of advantages and scalability is only one of them. Instead of pre-installing all available languages on each device sold around the world, langpacks let the user decide which language they need (and which they don't). They make it possible to decouple localization updates from OS updates and updates of individual apps, which might be useful for testing and for releasing early versions of localizations to gather feedback.
Where I see langpacks shine is in the fact that they move the decision making from developers to localizers and users. If pre-installing languages on the device is 'push', then langpacks are 'pull'. With langpacks, the community can test new translations easily. We can cater to the needs of minority languages. And the users can decide which languages they want to have their devices available in.