SiteLocale
Helper methods for the locale system.
Tags
Table of Contents
$ci | ContainerInterface | |
---|---|---|
__construct() | mixed | |
getAvailable() | Returns the list of available locale, as defined in the config. | \UserFrosting\I18n\Locale[] |
isAvailable() | Check if a locale identifier is available in the config. | bool |
getAvailableOptions() | Returns the list of available locale, as defined in the config. | string[] |
getAvailableIdentifiers() | Returns the list of available locales identifiers (string), as defined in the config. | string[] |
getDefaultLocale() | Returns the default locale from the config. | string |
getLocaleIndentifier() | Returns the locale intentifier (ie. en_US) to use. | string |
getBrowserLocale() | Return the browser locale. | string|null |
Properties
$ci
protected
ContainerInterface
$ci
Methods
__construct()
public
__construct(
$ci :
ContainerInterface
)
: mixed
Parameters
- $ci : ContainerInterface
Return values
mixedgetAvailable()
Returns the list of available locale, as defined in the config.
public
getAvailable(
)
: \UserFrosting\I18n\Locale[]
Return the list as an array of \UserFrosting\I18n\Locale instances.
Return values
\UserFrosting\I18n\Locale[]isAvailable()
Check if a locale identifier is available in the config.
public
isAvailable(
$identifier :
string
)
: bool
Parameters
- $identifier : string
Return values
boolgetAvailableOptions()
Returns the list of available locale, as defined in the config.
public
getAvailableOptions(
)
: string[]
Formatted as an array that can be used to populate an HTML select element.
Keys are identifier, and value is the locale name, eg. fr_FR => French (Français)
.
Return values
string[]getAvailableIdentifiers()
Returns the list of available locales identifiers (string), as defined in the config.
public
getAvailableIdentifiers(
)
: string[]
The default locale will always be added in the available list.
Return values
string[] —Array of locale identifiers
getDefaultLocale()
Returns the default locale from the config.
public
getDefaultLocale(
)
: string
Return values
stringgetLocaleIndentifier()
Returns the locale intentifier (ie. en_US) to use.
public
getLocaleIndentifier(
)
: string
Return values
string —Locale intentifier
getBrowserLocale()
Return the browser locale.
protected
getBrowserLocale(
)
: string|null
Return values
string|null —Returns null if no valid locale can be found