Name Description Size
AppDateTimeFormat.cpp static 8271
AppDateTimeFormat.h Get a DateTimeFormat for use in Gecko. This specialized DateTimeFormat respects the user's OS and app preferences, and provides caching of the underlying mozilla::intl resources. This class is not thread-safe as it lazily initializes a cache without any type of multi-threaded protections. 3012 Derived from the Unicode Common Locale Data Repository by For terms of use, see 2641 3768
components.conf 1070 872
LangPackMatcher.sys.mjs Attempts to find an appropriate langpack for a given language. The async function is infallible, but may not return a langpack. @returns {{ langPack: LangPack | null, langPackDisplayName: string | null }} 11301 6232
LocaleService.cpp This function splits an input string by `,` delimiter, sanitizes the result language tags and returns them to the caller. 20550
LocaleService.h LocaleService is a manager of language negotiation in Gecko. It's intended to be the core place for collecting available and requested languages and negotiating them to produce a fallback chain of locales for the application. Client / Server LocaleService may operate in one of two modes: server in the server mode, LocaleService is collecting and negotiating languages. It also subscribes to relevant observers. There should be at most one server per application instance. client in the client mode, LocaleService is not responsible for collecting or reacting to any system changes. It still distributes information about locales, but internally, it gets information from the server instance instead of collecting it on its own. This prevents any data desynchronization and minimizes the cost of running the service. In both modes, all get* methods should work the same way and all static methods are available. In the server mode, other components may inform LocaleService about their status either via calls to set* methods or via observer events. In the client mode, only the process communication should provide data to the LocaleService. At the moment desktop apps use the parent process in the server mode, and content processes in the client mode. Locale / Language The terms `Locale ID` and `Language ID` are used slightly differently by different organizations. Mozilla uses the term `Language ID` to describe a string that contains information about the language itself, script, region and variant. For example "en-Latn-US-mac" is a correct Language ID. Locale ID contains a Language ID plus a number of extension tags that contain information that go beyond language inforamation such as preferred currency, date/time formatting etc. An example of a Locale ID is `en-Latn-US-x-hc-h12-ca-gregory` At the moment we do not support full extension tag system, but we try to be specific when naming APIs, so the service is for locales, but we negotiate between languages etc. 8111
mac 2194
mozILocaleService.idl List of language negotiation strategies to use. For an example list of requested and available locales: Requested: ['es-MX', 'fr-FR'] Available: ['fr', 'fr-CA', 'es', 'es-MX', 'it'] DefaultLocale: ['en-US'] each of those strategies will build a different result: filtering (default) - Matches as many of the available locales as possible. Result: Supported: ['es-MX', 'es', 'fr', 'fr-CA', 'en-US'] matching - Matches the best match from the available locales for every requested locale. Result: Supported: ['es-MX', 'fr', 'en-US'] lookup - Matches a single best locale. This strategy always returns a list of the length 1 and requires a defaultLocale to be set. Result: Supported: ['es-MX'] 6217
mozIOSPreferences.idl Returns a list of locales used by the host environment for UI localization. The result is a sorted list and we expect that the OS attempts to use the top locale from the list for which it has data. Each element of the list is a valid locale ID that can be passed to ICU and ECMA402 Intl APIs, At the same time each element is a valid BCP47 language tag that can be used for language negotiation. Example: ["en-US", "de", "pl", "sr-Cyrl", "zh-Hans-HK"] 3374
MozLocaleBindings.h 672
nsLanguageAtomService.cpp 8668
nsLanguageAtomService.h The nsILanguageAtomService provides a mapping from languages or charsets to language groups, and access to the system locale language. 2284
nsUConvPropertySearch.cpp 1203
nsUConvPropertySearch.h Looks up a property by value. @param aProperties the static property array @param aKey the key to look up @param aValue the return value (empty string if not found) @return NS_OK if found or NS_ERROR_FAILURE if not found 1033
OSPreferences.cpp This is a shared part of the OSPreferences API implementation. It defines helper methods and public methods that are calling platform-specific private methods. 18355
OSPreferences.h OSPreferences API provides a set of methods for retrieving information from the host environment on topics such as: - Internationalization - Localization - Regional preferences The API is meant to remain as simple as possible, relaying information from the host environment to the user without too much logic. Saying that, there are two exceptions to that paradigm. First one is normalization. We do intend to translate host environment concepts to unified Intl/L10n vocabulary used by Mozilla. That means that we will format locale IDs, timezone names, currencies etc. into a chosen format. Second is caching. This API does cache values and where possible will hook into the environment for some event-driven cache invalidation. This means that on platforms that do not support a mechanism to notify apps about changes, new OS-level settings may not be reflected in the app until it is relaunched. 6547 899
Quotes.cpp 2715
Quotes.h Return a pointer to the Quotes record for the given locale (lang attribute), or nullptr if none available. The returned value points to a hashtable entry, but will remain valid until shutdown begins, as the table is not modified after initialization. 1266