Environments¶
While all the concepts described above apply to all programming languages and frameworks used by Mozilla, there are differences in completeness of the implementation.
Below is the current list of APIs supported in each environment and examples of how to use them:
C++¶
In C++ the core API for Locale is mozilla::intl::Locale
and the service for locale
management is mozilla::intl::LocaleService
.
For any OSPreference operations there’s mozilla::intl::OSPreferences
.
JavaScript¶
In JavaScript users can use mozilla.org/intl/mozILocaleService
XPCOM API to access
the LocaleService and mozilla.org/intl/mozIOSPreferences
for OS preferences.
The LocaleService API is exposed as Services.locale
object.
There’s currently no API available for operations on language tags and Locale objects, but Intl.Locale API is in the works.
Rust¶
For Rust Mozilla provides a crate fluent-locale which implements the concepts described above.