PHP Class MultilingualPlugin, addons

You can trigger an alternate locale by adding 'locale' in the query string, setting var vanilla_embed_locale in an embedded forum, or selecting one of the language links added to the footer. User-selected locale takes precedence. The selected locale is stored in the session. If it is user-selected AND the user is logged in, it is stored in UserMeta.
Inheritance: extends Gdn_Plugin
Mostrar archivo Open project: vanilla/addons Class Usage Examples

Protected Properties

Property Type Description
$overrides

Public Methods

Method Description
base_render_before ( $Sender ) Show alternate locale options in Foot.
enabledLocales ( ) : array Return the enabled locales suitable for local choosing.
gdn_dispatcher_afterAnalyzeRequest_handler ( $Sender ) Set user's preferred locale.
profileController_setLocale_create ( $Sender, $locale, $TK ) Allow user to set their preferred locale via link-click.

Protected Methods

Method Description
getAlternateLocale ( ) Get user preference or queried locale.
validateLocale ( string $Locale ) : string Confirm selected locale is valid and available.

Method Details

base_render_before() public method

Show alternate locale options in Foot.
public base_render_before ( $Sender )

enabledLocales() public static method

Return the enabled locales suitable for local choosing.
public static enabledLocales ( ) : array
return array Returns an array in the form `[locale => localeName]`.

gdn_dispatcher_afterAnalyzeRequest_handler() public method

Moved event from AppStart to AfterAnalyzeRequest to allow Embed to set P3P header first.

getAlternateLocale() protected method

Get user preference or queried locale.
protected getAlternateLocale ( )

profileController_setLocale_create() public method

Allow user to set their preferred locale via link-click.
public profileController_setLocale_create ( $Sender, $locale, $TK )

validateLocale() protected method

Confirm selected locale is valid and available.
protected validateLocale ( string $Locale ) : string
$Locale string Locale code.
return string Returns the canonical version of the locale on success or an empty string otherwise.

Property Details

$overrides protected_oe static_oe property

protected static $overrides