Getting started
NOTE
We will be using ES6 in the code samples in the guide.
Also, all examples will be using the full version of Vue to make on-the-fly template compilation possible. See more details here .
Creating a global application with Vue + Vue I18n is dead simple. With Vue.js, we are already composing our application with components. When adding Vue I18n to the mix, all we need to do is ready resource messages and simply use the localization API that are offered with Vue I18n.
Here’s a basic example via script tag:
HTML
In the HTML template, we use the
$t
translation API injected with Vue I18n, to localize. This allows Vue I18n to change the locale without rewriting the template, also to be able to support the global application.
JavaScript
Output the following: