Mojo.Locale
Namespace Detail
Summary
- Mojo.Locale.getDayNames
- Mojo.Locale.getMonthNames
Method Summary
- Mojo.Locale.getCurrentFormatRegion()
- Mojo.Locale.getCurrentLocale()
- Mojo.Locale.readStringTable(fileName, locale, pathToResourcesDir, mergeFunc)
Detail
Mojo.Locale.getDayNames
Returns an array containing the names of the weekdays in calendar order for the current locale. Array always starts with Sunday.
Mojo.Locale.getMonthNames
Returns an array containing the names of the months in calendar order for the current locale. Array always starts with January.
Method Detail
Mojo.Locale.getCurrentFormatRegion()
Returns the currently set region used for formatting (numbers, currency, dates, etc.; see Mojo.Format for more information) as an ISO 639- formatted string (e.g., 'us' for US formatting).
Returns
Current format region identifier string.
Mojo.Locale.getCurrentLocale()
Returns the currently set locale as an ISO 639-formatted string (e.g., 'en_us'
for US English).
Returns
Current locale identifier string.
Mojo.Locale.readStringTable(fileName, locale, pathToResourcesDir, mergeFunc)
This method loads and merges the localized string tables present in the application's or framework's resource locale hierarchy and returns the parsed results.
Parameters
-
{String} fileName - name of JSON file. Defaults to "strings.json" if falsy.
-
{String} locale - name of locale. Defaults to current locale if null/undefined; nothing if empty string.
-
{String} pathToResourcesDir - defaults to the framework's resources directory.
-
{Function} mergeFunc - a function for merging an array of string "tables" into a single object. It takes the form of mergeFunc(tables), where 'tables' is an array of objects/arrays whose properties/values represent entries in a string table, and returns the resulting merger of those tables.
The 'tables' param is sorted in order of locale precedence from lowest to highest: unlocalized first, language second, region last. Missing string table files at any of those levels will be represented by an empty object: {}. Defaults to a function that merges Objects using Object.extend().