Class humhub\components\i18n\I18N

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

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

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$messageOverwritePath string Path which contains message overwrites humhub\components\i18n\I18N
$unsupportedYiiLanguages array List of languages humhub\components\i18n\I18N

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
fixLocaleCodes() Ensure that old language codes are translated to the current format. humhub\components\i18n\I18N
getTranslationCategory() Returns the default translation category for a given moduleId. humhub\components\i18n\I18N
setLocale() Sets the language locale of Yii::$app->language and Yii::$app->formatter. humhub\components\i18n\I18N

Property Details

$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 ( )
fixLocaleCodes() protected method

Ensure that old language codes are translated to the current format.

protected void fixLocaleCodes ( )
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
getTranslationCategory() protected method

Returns the default translation category for a given moduleId.

Examples:

 example -> ExampleModule.
 long_module_name -> LongModuleNameModule.
protected string getTranslationCategory ( $moduleId )
$moduleId string
return string

Category Id

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