i18nPlugin
Defined in: plugins/i18nPlugin.ts:71
i18n module class.
Extends
Implements
Constructors
new i18nPlugin()
new i18nPlugin(
id
):i18nPlugin
Defined in: plugins/Plugin.ts:40
Parameters
id
string
= 'Plugin'
Returns
Inherited from
Properties
__dill_pixel_method_binding_root
__dill_pixel_method_binding_root:
boolean
Defined in: plugins/Plugin.ts:37
Inherited from
Plugin
.__dill_pixel_method_binding_root
id
readonly
id:"i18n"
='i18n'
Defined in: plugins/i18nPlugin.ts:72
Implementation of
Overrides
onLocaleChanged
onLocaleChanged:
Signal
<(locale
) =>void
>
Defined in: plugins/i18nPlugin.ts:73
Implementation of
Accessors
app
Get Signature
get app():
T
Defined in: plugins/Plugin.ts:45
Returns
T
Implementation of
Inherited from
locale
Get Signature
get locale():
string
Defined in: plugins/i18nPlugin.ts:83
Getter for locale.
Returns
string
Implementation of
locales
Get Signature
get locales():
string
[]
Defined in: plugins/i18nPlugin.ts:87
Returns
string
[]
Implementation of
Methods
addSignalConnection()
addSignalConnection(…
args
):void
Defined in: plugins/Plugin.ts:71
Add signal connections to the container.
Parameters
args
…SignalConnection
[]
The signal connections to add.
Returns
void
Implementation of
Ii18nPlugin
.addSignalConnection
Inherited from
clearSignalConnections()
clearSignalConnections():
void
Defined in: plugins/Plugin.ts:77
Returns
void
Implementation of
Ii18nPlugin
.clearSignalConnections
Inherited from
destroy()
destroy():
void
Defined in: plugins/Plugin.ts:49
Returns
void
Implementation of
Inherited from
initialize()
initialize(
app
,options
):Promise
<void
>
Defined in: plugins/i18nPlugin.ts:98
Initializes the i18n module. sets the default locale and loads the locale files.
Parameters
app
The application instance.
options
Partial
<i18nOptions
>
The i18n options.
Returns
Promise
<void
>
Promise
Implementation of
Overrides
loadLocale()
loadLocale(
localeId
):Promise
<void
>
Defined in: plugins/i18nPlugin.ts:222
Loads a locale.
Parameters
localeId
string
The locale id to load.
Returns
Promise
<void
>
Promise
Implementation of
parse()
parse(
input
,locale
):string
Defined in: plugins/i18nPlugin.ts:198
Parses the input string and replaces anything in between {} braces, assuming it is a key in the dictionary.
Parameters
input
string
locale
string
= ...
Returns
string
Implementation of
postInitialize()
postInitialize(
_app
):void
|Promise
<void
>
Defined in: plugins/Plugin.ts:60
Parameters
_app
Returns
void
| Promise
<void
>
Implementation of
Inherited from
setLocale()
setLocale(
localeId
):Promise
<string
>
Defined in: plugins/i18nPlugin.ts:119
Sets the locale. If the locale is not loaded, it will load it first.
Parameters
localeId
string
The locale id to set.
Returns
Promise
<string
>
Promise
Implementation of
t()
t(
key
,params
?,locale
?):string
Defined in: plugins/i18nPlugin.ts:137
Translates a key into a string. If the key is not found, it will return an empty string. If the key is found, it will replace any placeholders in the string with the values from the params object. If the key contains a variant, it will select a random variant if the variant param is set to ‘random’. If the key contains a number variant, it will select the variant based on the variant param.
Parameters
key
string
The key to translate.
params?
The parameters to replace in the string.
locale?
string
= ...
The locale to use for translation.
Returns
string
The translated string.
Implementation of
translate()
translate(
key
,params
?,locale
?):string
Defined in: plugins/i18nPlugin.ts:188
Translates a key into a string (alias for t)
Parameters
key
string
The key to translate.
params?
The parameters to replace in the string.
locale?
string
= ...
The locale to use for translation.
Returns
string
The translated string.