#
hs.host.locale
Retrieve information about the user's Language and Region settings.
Locales encapsulate information about linguistic, cultural, and technological conventions and standards. Examples of information encapsulated by a locale include the symbol used for the decimal separator in numbers and the way dates are formatted. Locales are typically used to provide, format, and interpret information about and according to the user’s customs and preferences.
#
API Overview
Functions - API calls offered directly by the extension
availableLocales current details localizedString preferredLanguages registerCallback unregisterCallback
#
API Documentation
#
Functions
#
availableLocales
Signature | hs.host.locale.availableLocales() -> table |
Type | Function |
Description | Returns an array table containing the identifiers for the locales available on the system. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/host/locale/libhost_locale.m line 172 |
#
current
Signature | hs.host.locale.current() -> string |
Type | Function |
Description | Returns an string specifying the user's currently selected locale identifier. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/host/locale/libhost_locale.m line 219 |
#
details
Signature | hs.host.locale.details([identifier]) -> table |
Type | Function |
Description | Returns a table containing information about the current or specified locale. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/host/locale/libhost_locale.m line 238 |
#
localizedString
Signature | hs.host.locale.localizedString(localeCode[, baseLocaleCode]) -> string | nil, string | nil |
Type | Function |
Description | Returns the localized string for a specific language code. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/host/locale/libhost_locale.m line 317 |
#
preferredLanguages
Signature | hs.host.locale.preferredLanguages() -> table |
Type | Function |
Description | Returns the user's language preference order as an array of strings. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/host/locale/libhost_locale.m line 197 |
#
registerCallback
Signature | hs.host.locale.registerCallback(function) -> uuidString |
Type | Function |
Description | Registers a function to be invoked when anything in the user's locale settings change |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/host/locale/host_locale.lua line 28 |
#
unregisterCallback
Signature | hs.host.locale.unregisterCallback(uuidString) -> boolean |
Type | Function |
Description | Unregister a callback function when you no longer care about changes to the user's locale |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/host/locale/host_locale.lua line 52 |