https://github.com/owl1n/vue-translations
VueJs translations very similar to Laravel Translation system
https://github.com/owl1n/vue-translations
i18n translation vue vue-i18n vue-translations vuejs vuejs-translations vuejs2
Last synced: about 2 months ago
JSON representation
VueJs translations very similar to Laravel Translation system
- Host: GitHub
- URL: https://github.com/owl1n/vue-translations
- Owner: owl1n
- License: mpl-2.0
- Created: 2017-09-25T06:58:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-18T18:01:49.000Z (almost 6 years ago)
- Last Synced: 2025-03-27T05:51:14.262Z (2 months ago)
- Topics: i18n, translation, vue, vue-i18n, vue-translations, vuejs, vuejs-translations, vuejs2
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 15
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## VueJs Translations :shipit:
Hello everybody! I'm glad to present you a library to support the translations in your Vue project.
This translations component is very similar to Laravel Translations. You can setup inline params in your locale if needed.
Installation is very simple, in a few steps:
```shell
npm i vue-translations
```You need to setup locale file for yourself.
```javascript
// locales.js
export default {
en: {
home: {
header: 'My best project ever',
},
},
ru: {
home: {
header: 'Мой лучший проект в жизни',
},
},
};
``````javascript
import VueTranslation from 'vue-translations'
import locales from './locales.js';Vue.use(VueTranslations);
new Vue({
mounted() {
// setup from one method
this.$translations.setup('en', locales);
// another methods:
// change current language
this.$translations.setLang('en');
// load locales
this.$translations.load(locales);
},
render: (h) => h,
});
```Use it in your projects is easy!
```javascript
```
### Inline params
Into your locale file
```javascript
en: {
home: {
header: 'My best project - :name',
},
},
},
```Into your application
```javascript
// output: My best project - Project
```