Skip to content

FrontLabsOfficial/vue-i18n-lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฅ๏ธ Vue I18n Lite

A super lightweight and minimal plugin that introduces internationalization into your Vue.js app with a simple API

๐Ÿš€ Usage

Plugin

import { createApp } from 'vue';
import { createI18n } from 'vue-i18n-lite';
import App from './App.vue';

const i18n = createI18n({
    locale: 'en',
    fallbackLocale: 'en',
    messages: {
        'en': {
            home: 'Home'
        }
    }
})

const app = createApp(App);
app.use(i18n);

Composition API

import { useI18n } from 'vue-i18n-lite';

export default {
    setup() {
        const i18n = useI18n()
        i18n.createI18n({
            locale: 'en',
            fallbackLocale: 'en',
            messages: {
                'en': {
                    home: 'Home'
                }
            }
        })

        const { current, changeLocale } = i18n

        return {
            current,
            changeLocale
        }
    }
}

๐Ÿ“ฆ Install

yarn add vue-i18n-lite

CDN

<script src="https://unpkg.com/vue-i18n-lite"></script>

It will be exposed to global as window.VueI18nLite

Changelog

Detail changes for each release are documented in the CHANGELOG.md file.

โค๏ธ Thanks

This project is inspired by the following awesome projects.

๐Ÿ“„ License

MIT License ยฉ 2021 Erik Pham