TTi18n - staffcheck/api GitHub Wiki
- Class name: TTi18n
- Namespace:
private mixed $language = 'en'
- Visibility: private
- This property is static.
private mixed $country = 'US'
- Visibility: private
- This property is static.
private mixed $master_locale = NULL
- Visibility: private
- This property is static.
private mixed $locale = NULL
- Visibility: private
- This property is static.
private mixed $normalized_locale = NULL
- Visibility: private
- This property is static.
private mixed $is_default_locale = TRUE
- Visibility: private
- This property is static.
private mixed $currency_formatter = FALSE
- Visibility: private
- This property is static.
private mixed $number_formatter = FALSE
- Visibility: private
- This property is static.
private mixed $DEFAULT_NUMBER_FORMAT_PATTERN = '#,##0.##'
- Visibility: private
- This property is static.
boolean TTi18n::setGetTextLocale($locale)
- Visibility: public
- This method is static.
- $locale mixed
string TTi18n::getLanguage()
- Visibility: public
- This method is static.
boolean TTi18n::setLanguage($language)
- Visibility: public
- This method is static.
- $language mixed
string TTi18n::getCountry()
- Visibility: public
- This method is static.
boolean TTi18n::setCountry($country)
- Visibility: public
- This method is static.
- $country mixed
string TTi18n::getLocaleArrayAsString($locale_arr)
- Visibility: public
- This method is static.
- $locale_arr mixed
boolean|string TTi18n::tryLocale($locale)
- Visibility: public
- This method is static.
- $locale mixed
array|mixed TTi18n::generateLocale(null $locale_arg)
- Visibility: public
- This method is static.
- $locale_arg null
boolean TTi18n::setMasterLocale()
- Visibility: public
- This method is static.
boolean|string TTi18n::stripUTF8($str)
- Visibility: public
- This method is static.
- $str mixed
boolean TTi18n::setLocaleCookie(null $locale)
- Visibility: public
- This method is static.
- $locale null
boolean TTi18n::getLocaleCookie()
- Visibility: public
- This method is static.
boolean|string TTi18n::getLanguageFromLocale(null $locale)
- Visibility: public
- This method is static.
- $locale null
boolean TTi18n::getCountryFromLocale(null $locale)
- Visibility: public
- This method is static.
- $locale null
null TTi18n::getNormalizedLocale()
- Visibility: public
- This method is static.
null TTi18n::getLocale()
- Visibility: public
- This method is static.
boolean TTi18n::setLocale(null $locale_arg, integer $category, boolean $force)
- Visibility: public
- This method is static.
- $locale_arg null
- $category integer
- $force boolean
array TTi18n::getBrowserLanguage()
- Visibility: public
- This method is static.
string|boolean TTi18n::chooseBestLocale(string|array $user_locale_pref)
Determines the most appropriate locale, based on user metadata including the user's saved locale preference (if any), the user's browser lang pref, and the application's default locale. It also allows an override via setting URL param 'ttlang' to a valid locale.
Returns the best locale, or false if unable to find and set a locale.
- Visibility: public
- This method is static.
- $user_locale_pref string|array
array TTi18n::getLanguageArray()
- Visibility: public
- This method is static.
string TTi18n::getTextStringArgs($str, $args)
- Visibility: public
- This method is static.
- $str mixed
- $args mixed
string TTi18n::getText($str, boolean $args)
- Visibility: public
- This method is static.
- $str mixed
- $args boolean
string TTi18n::gt($str, boolean $args)
- Visibility: public
- This method is static.
- $str mixed
- $args boolean
string TTi18n::_normalizeLocale(string $locale)
Returns a fully normalized locale string, or the original string if no match was found.
- Visibility: protected
- This method is static.
- $locale string - a locale string of the form 'es', or 'es_CR'. Both will be converted to 'es_ES'
string TTi18n::getPDFDefaultFont(null $language, boolean $encoding)
- Visibility: public
- This method is static.
- $language null
- $encoding boolean
string TTi18n::strtolower($str)
- Visibility: public
- This method is static.
- $str mixed
string TTi18n::strtoupper($str)
- Visibility: public
- This method is static.
- $str mixed
mixed TTi18n::getCurrencyArray()
- Visibility: public
- This method is static.
string TTi18n::parseFloat($value)
Parses a locale specific string that represents a float (ie: -46,1234 or -46.1234) and converts it to a float that PHP will recognize for functions like number_format()/round, etc.
..
- Visibility: public
- This method is static.
- $value mixed
string TTi18n::getDecimalSymbol()
Get the current locale's decimal symbol
- Visibility: public
- This method is static.
string TTi18n::getThousandsSymbol()
Get the current locale's thousands separator symbol
- Visibility: public
- This method is static.
integer TTi18n::getAfterDecimal($number, integer $min_decimals, integer $max_decimals)
- Visibility: public
- This method is static.
- $number mixed
- $min_decimals integer
- $max_decimals integer
string TTi18n::formatNumber(\decimal $number, boolean $auto_format_decimals, integer $min_decimals, integer $max_decimals)
Format a number in the manner consistent with the current locale -In the first case, only the number is provided. this formats to the default pattern for the locale.
-In the second case, $auto_format_decimals is provided as TRUE with both $min_decimals and $max_decimals set. this defines the number of decimals.
- Visibility: public
- This method is static.
- $number decimal
- $auto_format_decimals boolean
- $min_decimals integer
- $max_decimals integer
mixed|string TTi18n::formatCurrency($amount, null $currency_code, integer $show_code)
- Visibility: public
- This method is static.
- $amount mixed
- $currency_code null
- $show_code integer
mixed|string TTi18n::getCurrencySymbol($iso_code)
- Visibility: public
- This method is static.
- $iso_code mixed
boolean TTi18n::detectUTF8($string)
- Visibility: public
- This method is static.
- $string mixed