Additional functions and plugins added to the Vue object.
For documentation on Vue's built-in functions, see Vue's API reference.
- Source:
Methods
$i18n(key, …parameters) → {mw.Message}
#
Adds an $i18n()
instance method that can be used in all components. This method is a
proxy to mw.message
.
Usage:
<p>{{ $i18n( 'my-message-key', param1, param2 ) }}</p>
or
<p>{{ $i18n( 'my-message-key' ).params( [ param1, param2 ] ) }}</p>
Note that this method only works for messages that return text. For messages that
need to be parsed to HTML, use the v-i18n-html
directive.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string | Key of message to get |
|
parameters |
any |
repeatable |
Values for $N replacements |
- Source:
Returns:
- Type
- mw.Message
$i18n()
instance method that can be used in all components.
createMwApp(…args) → {Object}static
#
Wrapper around Vue.createApp that
adds the i18n plugin
and the error handler. These were added
globally in Vue 2, but Vue 3 does not support global plugins.
To ensure all Vue code has the i18n plugin and the error handler installed, use of
vue.createMwApp()
is recommended anywhere one would normally use Vue.createApp()
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
any |
repeatable |
- Source:
Returns:
Vue app instance
- Type
- Object
Wrapper around Vue.createApp that
adds the i18n plugin
and the error handler.