intl/docs/locale_env.rst
author Bryce Van Dyk <bvandyk@mozilla.com>
Mon, 14 Jan 2019 16:40:29 +0000
changeset 513748 bd1e99a6325ade1c8839e8e7b7310b76609e3c0a
parent 476963 38922a89e9d5d957a95e4344a369a5ef345c5a1c
permissions -rw-r--r--
Bug 1516669 - Check init value of clearkey WMF decoder for failure. r=cpearce We weren't checking this value and it was causing compiler warnings. Instead this change means we check the value and log an error if init has failed. Differential Revision: https://phabricator.services.mozilla.com/D15519

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 :js:`mozilla::intl::Locale` and the service for locale
management is :js:`mozilla::intl::LocaleService`.

For any OSPreference operations there's :js:`mozilla::intl::OSPreferences`.


JavaScript
----------

In JavaScript users can use :js:`mozilla.org/intl/mozILocaleService` XPCOM API to access
the LocaleService and :js:`mozilla.org/intl/mozIOSPreferences` for OS preferences.

The LocaleService API is exposed as :js:`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.