Socket
Socket
Sign inDemoInstall

vue3-i18n

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-i18n

A i18n plugin for Vue3


Version published
Weekly downloads
654
decreased by-10.29%
Maintainers
1
Weekly downloads
 
Created
Source

vue3-i18n

Vue 3.x

I18n for vue3.

Note:

Issue/PR is welcomed, I'll response as soon as possible.

If you like this pack, can give a star.

Usage

install

npm install vue3-i18n --save

Quickstart

// i18n.js 
import { createI18n } from "vue3-i18n";

const messages = {
  en: {
    menu: ["Home"],
    test: "test",
  },
  zh: {
    menu: ["首页"],
    test: "测试",
  },
};

const i18n = createI18n({
  locale: "en",
  messages: messages,
});

export default i18n;

// main.js
import { createApp } from "vue";
import i18n from "./i18n";

const app = createApp(App);

app
  .use(i18n)
  .mount("#app");

Usage

<p>{{ $t("test") }}</p>
<!-- array -->
<p>{{ $t("test[1]") }}</p>
<!-- object -->
<p>{{ $t("test.a") }}</p>
<script>
import { useI18n } from "vue3-i18n";
export default {
  setup() {
    const i18n = useI18n();
    const setLocale = (lang) => {
      i18n.setLocale(lang);
    };

    return {
      setLocale,
    };
  },
};
</script>
TODO
  • directive
  • Named formatting

License

MIT

Keywords

FAQs

Package last updated on 07 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc