Locale API Documentation
Locale API provides functionality to format number, dates and other contents according to locale settings
Init: $localeApi = $api->get('sophielabs_locale');
Method: $localeApi->getAvailableLocales(...)
Returns the available locales
Returns Array
Method: $localeApi->hasAvailableLocale(...)
Returns if a locale is available
Returns Boolean
Method: $localeApi->getLocale(...)
Returns the current locale
Returns String
Method: $localeApi->getLocaleInfo(...)
Returns information for the current locale
Returns Array Locale Information returned by PHP function localeconv for the current locale
Method: $localeApi->getLocaleDecimalPoint(...)
Returns the decimal point character for the current locale
Returns String
Method: $localeApi->getLocaleThousandsSeparator(...)
Returns the thousands separator character for the current locale
Returns String
Method: $localeApi->formatNumber(...)
Formats a number according to parameters and locale settings
Parameters:
- $number int|float Numericvalue to be formatted
- $decimals int Number of decimals, defauls to 2
- $decimalPoint int|null Decimal point character, defaults to locale setting
- $thousandsSeparator int|null Thousands separator character, defaults to locale setting