GithubHelp home page GithubHelp logo

dvhoangfh / vue-i18n-lite Goto Github PK

View Code? Open in Web Editor NEW

This project forked from frontlabsofficial/vue-i18n-lite

0.0 0.0 0.0 231 KB

๐ŸŒ Lightweight, minimal internationalization plugin for Vue.js

Home Page: https://www.npmjs.com/package/vue-i18n-lite

License: MIT License

JavaScript 46.26% TypeScript 46.20% HTML 1.35% Vue 6.19%

vue-i18n-lite's Introduction

๐Ÿ”ฅ๏ธ 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

vue-i18n-lite's People

Contributors

phucpham095 avatar erikpham avatar niutech avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.