The goog.locale Namespace

The goog.locale.Resource Enum

Enum of resources that can be registered. … more

.TimeZoneFingerprint

Time zone fingerprint mapping to time zone list.

@enum
{Array.<string>}

.TimeZoneList

.countries {Array}

List of codes for countries valid today.

.defaultLocaleNameConstants

Default list of locale specific country and language names

The goog.locale.genericFontNames Namespace

… more

.genericFontNamesData {Object}

Map from script code or language code to list of pairs of (generic name, font name fallback list).

.getLanguageSubTag(languageCode)

Returns the language-subtag of the given language code.

languageCode {string}
Language code to extract language subtag from.
returns {string}
Language subtag (in lowercase).

.getLocalizedCountryName(languageCode, opt_localeSymbols)

Returns the localized country name for the provided language code in the current or provided locale symbols set. This method depends on goog.locale.LocaleNameConstants__ available from http://go/js_locale_data. User of this method has to add dependency to this.

languageCode {string}
Language code to lookup the country name for.
opt_localeSymbols {Object=}
If omitted the current locale symbol set is used.
returns {string}
Localized country name.

.getLocalizedLanguageName(languageCode, opt_localeSymbols)

Returns the localized language name for the provided language code in the current or provided locale symbols set. This method depends on goog.locale.LocaleNameConstants__ available from http://go/js_locale_data. User of this method has to add dependency to this.

languageCode {string}
Language code to lookup the language name for.
opt_localeSymbols {Object=}
locale symbol set if given.
returns {string}
Localized language name of the provided language code.

.getNativeCountryName(countryCode)

Returns the country name of the provided language code in its native language. This method depends on goog.locale.nativeNameConstants available from nativenameconstants.js. User of this method has to add dependency to this.

countryCode {string}
Code to lookup the country name for.
returns {string}
Country name for the provided language code.

.getNativeLanguageName(languageCode)

Returns the language name of the provided language code in its native language. This method depends on goog.locale.nativeNameConstants available from nativenameconstants.js. User of this method has to add dependency to this.

languageCode {string}
Language code to lookup the language name for.
returns {string}
Language name for the provided language code.

.getRegionSubTag(languageCode)

Returns the region-sub-tag of the given language code.

languageCode {string}
Language code to extract region subtag from.
returns {string}
Region sub-tag (in uppercase).

.getResource(resourceName, opt_locale)

Retrieve specified resource for certain locale.

resourceName {string}
String that represents the type of resource.
opt_locale {string=}
Locale ID, if not given, current locale will be assumed.
returns {Object|undefined}
The resource object that hold all the resource data, or undefined if not available.

.getResourceWithFallback(resourceName, opt_locale)

Retrieve specified resource for certain locale with fallback. For example, request of 'zh_CN' will be resolved in following order: zh_CN, zh, en. If none of the above succeeds, of if the resource as indicated by resourceName does not exist at all, undefined will be returned.

resourceName {string}
String that represents the type of resource.
opt_locale {string=}
locale ID, if not given, current locale will be assumed.
returns {Object|undefined}
The resource object for desired locale.

.getScriptSubTag(languageCode)

Returns the script subtag of the locale with the first alphabet in uppercase and the rest 3 characters in lower case.

languageCode {string}
Language Code to extract script subtag from.
returns {string}
Script subtag.

.getTimeZoneAllLongNames()

Returns the displayable list of long timezone names paired with its id for the current locale. This method depends on goog.locale.TimeZoneAllLongNames__ available from http://go/js_locale_data. User of this method has to add dependacy to this.

returns {Array.<Object>}
localized and relevant list of timezone names and ids.

.getTimeZoneSelectedLongNames(opt_regionOrLang)

Returns the displayable list of long timezone names paired with its id for the current locale, selected based on the region or language provided. This method depends on goog.locale.TimeZone*__ available from http://go/js_locale_data. User of this method has to add dependacy to this.

opt_regionOrLang {string=}
If region tag is provided, timezone ids specific this region are considered. If language is provided, all regions for which this language is defacto official is considered. If this parameter is not speficied, current locale is used to extract this information.
returns {Array.<Object>}
Localized and relevant list of timezone names and ids.

.getTimeZoneSelectedShortNames(opt_regionOrLang)

Returns the displayable list of short timezone names paired with its id for the current locale, selected based on the region or language provided. This method depends on goog.locale.TimeZone*__ available from http://go/js_locale_data. User of this method has to add dependacy to this.

opt_regionOrLang {string=}
If region tag is provided, timezone ids specific this region are considered. If language is provided, all regions for which this language is defacto official is considered. If this parameter is not speficied, current locale is used to extract this information.
returns {Array.<Object>}
Localized and relevant list of timezone names and ids.

.getVariantSubTag(languageCode)

Returns the variant-sub-tag of the given language code.

languageCode {string}
Language code to extract variant subtag from.
returns {string}
Variant sub-tag.

.isResourceRegistered(resourceName, localeName)

Returns true if the required resource has already been registered.

resourceName {goog.locale.Resource|string}
String that represents the type of resource.
localeName {string}
Locale ID.
returns {boolean}
Whether the required resource has already been registered.

.nativeNameConstants {Object}

Native country and language names

.registerLocaleNameConstants(dataObj, localeName)

Registers the LocaleNameConstants constants object for a given locale name.

dataObj {Object}
The resource object.
localeName {string}
Locale ID.

.registerResource(dataObj, resourceName, localeName)

Register a resource object for certain locale.

dataObj {Object}
The resource object being registered.
resourceName {goog.locale.Resource|string}
String that represents the type of resource.
localeName {string}
Locale ID.

.registerTimeZoneAllLongNames(dataObj, localeName)

Registers the TimeZoneAllLongNames constants object for a given locale name.

dataObj {Object}
The resource object.
localeName {string}
Locale ID.

.registerTimeZoneSelectedIds(dataObj, localeName)

Registers the TimeZoneSelectedIds constants object for a given locale name.

dataObj {Object}
The resource object.
localeName {string}
Locale ID.

.registerTimeZoneSelectedLongNames(dataObj, localeName)

Registers the TimeZoneSelectedLongNames constants object for a given locale name.

dataObj {Object}
The resource object.
localeName {string}
Locale ID.

.registerTimeZoneSelectedShortNames(dataObj, localeName)

Registers the TimeZoneSelectedShortNames constants object for a given locale name.

dataObj {Object}
The resource object.
localeName {string}
Locale ID.

.scriptToLanguages {Object}

The script code to list of language codes map.

.setLocale(localeName)

Set currnet locale to the specified one.

localeName {string}
Locale name string. We are following the usage in CLDR, but can make a few compromise for existing name compatibility.

The goog.locale.timeZoneDetection Namespace

… more