Hi Gaia devs!
I've been lately analyzing our Firefox OS core apps looking for examples of code that could and should be clustered into Intl API (separate from L10n API[1]).
Current revision of Intl API gives us three objects that you all should be using (I'll write more about it soon, once we land IntlHelper[2]):
- DateTimeFormat
- NumberFormat
- Collator
But the underlying library that we are using for that has a powerful database called CLDR that has much, much more. We'd like to tap into those resources based on what Gaia UI's could use now.
The first set of features that we're thinking about are:
1) Plural Forms
We're currently storing them in l20n.js and it takes a lot of space. It would be nice to have Intl.PluralForm API.
2) Timezone names
For our Settings/FTU we could just retrieve list of timezones in a given locale without having to ask our localizers to translate 100 names.
3) Units
The whole "5 KB", "35 °C", "15 KB/s" or even "5/101" should be handled by Intl.
4) Relative dates/times
We have a mock in l10n_date, but CLDR has much more for things like "2 minutes ago", "in 5 seconds", "yesterday" etc. (more examples in french: [3])
5) List formatting
This will eventually be part of localization, but it can be handled by Intl
["John", "Mary", "Jim"] => "John, Mary and Jim"
6) startDay
Which day of the week is first in a given locale
7) DateTime tokens order
day/month/year vs. month/day/year - for datetime picker
---
There are more items like that, but we think they may wait. So we want to start by implementing those things in our local mozIntl library and switch Firefox OS to use them. At the same time we'll be working with other vendors through Ecma on standardization of those bits and eventually we'll push them into Intl API.
You can read a fairly hectic list of items that we'd like to elevate from CLDR here:
https://l20n.etherpad.mozilla.org/mozintl
My question for you is - do you see in your code more examples of things that should be unified under mozIntl and potentially exposed in Intl API.
I can imagine lots of things related to Calendar, and I see some bits in Clock, but I don't know all the issues in all apps so would love to get feedback.
zb.
[1] The line between Intl and L10n is blurry, but roughly you can think of it this way - localization is everything where we work with a custom message in a given language and we want this message to be translated into a different language. Intl is where we have a piece of data - like 5 kb, or a date, or a number, and we need to operate on it - maybe format it, maybe sort it etc.
[2]
https://bugzilla.mozilla.org/show_bug.cgi?id=1191011
[3]
http://www.unicode.org/cldr/charts/27/summary/fr.html#5453