Class humhub\components\i18n\I18N

Inheritancehumhub\components\i18n\I18N » yii\i18n\I18N

I18N provides features related with internationalization (I18N) and localization (L10N).

Public Methods

Hide inherited methods

MethodDescriptionDefined By
autosetLocale() Automatically sets the current locale and time zone humhub\components\i18n\I18N
format() humhub\components\i18n\I18N
getAllowedLanguages() Returns an array of allowed/available language codes humhub\components\i18n\I18N
getMessageSource() humhub\components\i18n\I18N
setDefaultLocale() Sets the system default locale humhub\components\i18n\I18N
setGuestLocale() Sets the locale for the current guest user. humhub\components\i18n\I18N
setUserLocale() Sets the current locale and time zone for a given user. humhub\components\i18n\I18N
translate() humhub\components\i18n\I18N

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
setLocale() Sets the language locale of Yii::$app->language and Yii::$app->formatter. humhub\components\i18n\I18N

Property Details

$beforeTranslateCallback public property (available since version 1.4)
$messageOverwritePath public property

Path which contains message overwrites

public string $messageOverwritePath '@config/messages'
$unsupportedYiiLanguages public property

List of languages

Method Details

autosetLocale() public method

Automatically sets the current locale and time zone

public void autosetLocale ( )
format() public method

public void format ( $message, $params, $language )
$message
$params
$language
getAllowedLanguages() public method

Returns an array of allowed/available language codes

public array getAllowedLanguages ( )
return array

The allowed languages

getMessageSource() public method

public void getMessageSource ( $category )
$category
setDefaultLocale() public method

Sets the system default locale

public void setDefaultLocale ( )
setGuestLocale() public method

Sets the locale for the current guest user.

The language is determined by the a cookie

public void setGuestLocale ( )
setLocale() protected method

Sets the language locale of Yii::$app->language and Yii::$app->formatter.

protected void setLocale ( $locale )
$locale
setUserLocale() public method

Sets the current locale and time zone for a given user.

If no user is given the currently logged in user will be used.

public void setUserLocale ( $user )
$user humhub\modules\user\models\User
translate() public method

public void translate ( $category, $message, $params, $language )
$category
$message
$params
$language