├── packages ├── core │ ├── test │ │ └── .gitkeep │ ├── api-extractor.json │ └── src │ │ ├── index.ts │ │ └── runtime.ts ├── vue-i18n-core │ ├── src │ │ ├── plugin │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ └── next.ts │ │ ├── components │ │ │ └── index.ts │ │ ├── types.ts │ │ ├── warnings.ts │ │ ├── symbols.ts │ │ └── vue.d.ts │ ├── README.md │ ├── test │ │ ├── errors.test.ts │ │ ├── schema.ts │ │ ├── components │ │ │ └── components.test-d.tsx │ │ ├── plugin.test.ts │ │ └── __snapshots__ │ │ │ ├── issues.test.ts.snap │ │ │ ├── composer.test.ts.snap │ │ │ └── i18n.test.ts.snap │ ├── api-extractor.json │ └── api-extractor-petite.json ├── core-base │ ├── src │ │ ├── types │ │ │ └── index.ts │ │ ├── intl.ts │ │ ├── misc.ts │ │ └── index.ts │ ├── README.md │ ├── test │ │ ├── errors.test.ts │ │ ├── warnings.test.ts │ │ ├── schema.ts │ │ ├── helper.ts │ │ └── number.test-d.ts │ └── api-extractor.json ├── format-explorer │ ├── src │ │ ├── vite-env.d.ts │ │ ├── main.ts │ │ ├── assets │ │ │ └── favicon.ico │ │ ├── shims-vue.d.ts │ │ ├── components │ │ │ └── Navigation.vue │ │ └── utils.ts │ ├── public │ │ └── favicon.ico │ ├── index.html │ ├── README.md │ ├── package.json │ └── vite.config.ts ├── shared │ ├── src │ │ ├── error.ts │ │ ├── index.ts │ │ └── warn.ts │ ├── test │ │ └── __snapshots__ │ │ │ └── utils.test.ts.snap │ ├── api-extractor.json │ └── README.md ├── devtools-types │ ├── README.md │ └── api-extractor.json ├── message-compiler │ ├── README.md │ ├── api-extractor.json │ ├── src │ │ ├── index.ts │ │ ├── helpers.ts │ │ └── location.ts │ └── test │ │ ├── transformer.test.ts │ │ ├── helper.ts │ │ ├── __snapshots__ │ │ ├── mangler.test.ts.snap │ │ └── minifier.test.ts.snap │ │ └── mangler.test.ts ├── size-check-core │ ├── README.md │ ├── src │ │ └── main.ts │ ├── index.html │ ├── package.json │ ├── scripts │ │ └── size.mjs │ └── vite.config.ts ├── size-check-vue-i18n │ ├── README.md │ ├── src │ │ ├── shims-vue.d.ts │ │ └── App.vue │ ├── index.html │ ├── package.json │ └── scripts │ │ └── size.mjs ├── size-check-petite-vue-i18n │ ├── README.md │ ├── src │ │ ├── shims-vue.d.ts │ │ └── App.vue │ ├── index.html │ ├── package.json │ └── scripts │ │ └── size.mjs ├── vue-i18n │ ├── api-extractor.json │ └── vetur │ │ └── tags.json ├── petite-vue-i18n │ └── api-extractor.json └── global.d.ts ├── examples ├── lazy-loading │ ├── vite │ │ ├── public │ │ │ └── .gitkeep │ │ ├── src │ │ │ ├── assets │ │ │ │ └── .gitkeep │ │ │ ├── components │ │ │ │ └── .gitkeep │ │ │ ├── index.css │ │ │ ├── pages │ │ │ │ ├── Home.vue │ │ │ │ └── About.vue │ │ │ ├── locales │ │ │ │ ├── ja.json │ │ │ │ └── en.json │ │ │ ├── shims-vue.d.ts │ │ │ ├── vue-i18n.d.ts │ │ │ └── main.ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── index.html │ │ ├── vite.config.ts │ │ ├── tsconfig.app.json │ │ ├── package.json │ │ └── tsconfig.node.json │ └── webpack │ │ ├── src │ │ ├── components │ │ │ └── .gitkeep │ │ ├── pages │ │ │ ├── Home.vue │ │ │ └── About.vue │ │ ├── index.css │ │ ├── locales │ │ │ ├── ja.json │ │ │ └── en.json │ │ └── main.js │ │ ├── index.html │ │ ├── README.md │ │ └── package.json ├── web-components │ ├── src │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── vite-env.d.ts │ │ ├── components │ │ │ ├── HelloI18n.ce.vue │ │ │ └── HelloBlock.ce.vue │ │ ├── shims-vue.d.ts │ │ ├── main.ts │ │ └── App.vue │ ├── README.md │ ├── public │ │ └── favicon.ico │ ├── tsconfig.json │ ├── index.html │ ├── tsconfig.app.json │ ├── vite.config.ts │ ├── package.json │ └── tsconfig.node.json ├── storybook │ ├── .gitattributes │ ├── env.d.ts │ ├── public │ │ └── favicon.ico │ ├── src │ │ ├── main.ts │ │ ├── assets │ │ │ ├── logo.svg │ │ │ └── main.css │ │ ├── components │ │ │ ├── icons │ │ │ │ ├── IconSupport.vue │ │ │ │ ├── IconTooling.vue │ │ │ │ └── IconCommunity.vue │ │ │ └── HelloWorld.vue │ │ ├── stories │ │ │ ├── header.css │ │ │ ├── button.css │ │ │ ├── LocalizedPage.vue │ │ │ └── LocalizedPage.stories.ts │ │ └── App.vue │ ├── tsconfig.json │ ├── .editorconfig │ ├── tsconfig.app.json │ ├── .storybook │ │ └── main.ts │ ├── index.html │ ├── vite.config.ts │ ├── .gitignore │ ├── tsconfig.node.json │ ├── eslint.config.ts │ └── README.md ├── backend │ ├── db │ │ ├── en.json │ │ ├── ja.json │ │ └── message.d.ts │ ├── public │ │ └── favicon.ico │ ├── src │ │ ├── assets │ │ │ └── logo.png │ │ ├── constants.ts │ │ ├── env.d.ts │ │ ├── App.vue │ │ └── main.ts │ ├── tsconfig.json │ ├── index.html │ ├── tsconfig.app.json │ ├── scripts │ │ └── server.ts │ ├── tsconfig.node.json │ ├── package.json │ └── README.md ├── tsx │ ├── README.md │ ├── src │ │ ├── vite-env.d.ts │ │ ├── shims-vue.d.ts │ │ ├── main.ts │ │ ├── App.vue │ │ └── components │ │ │ └── HelloWorld.vue │ ├── public │ │ └── favicon.ico │ ├── tsconfig.json │ ├── vite.config.ts │ ├── index.html │ ├── tsconfig.app.json │ ├── package.json │ └── tsconfig.node.json ├── ssr │ ├── vite │ │ ├── dep-import-type │ │ │ ├── deep │ │ │ │ └── index.d.ts │ │ │ └── package.json │ │ ├── src │ │ │ ├── components │ │ │ │ ├── foo.css │ │ │ │ ├── ImportType.vue │ │ │ │ └── Foo.jsx │ │ │ ├── assets │ │ │ │ ├── logo.png │ │ │ │ └── fonts │ │ │ │ │ ├── Inter-Italic.woff │ │ │ │ │ └── Inter-Italic.woff2 │ │ │ ├── entry-client.js │ │ │ ├── pages │ │ │ │ ├── External.vue │ │ │ │ ├── About.vue │ │ │ │ └── Home.vue │ │ │ ├── locales │ │ │ │ ├── ja.json │ │ │ │ └── en.json │ │ │ ├── i18n.js │ │ │ ├── main.js │ │ │ └── router.js │ │ ├── example-external-component │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── ExampleExternalComponent.vue │ │ ├── README.md │ │ ├── index.html │ │ ├── vite.config.noexternal.js │ │ └── vite.config.js │ └── vitepress │ │ ├── README.md │ │ ├── .vitepress │ │ ├── theme │ │ │ └── index.ts │ │ └── config.ts │ │ ├── package.json │ │ ├── tsconfig.json │ │ ├── index.md │ │ └── api-examples.md ├── message-format │ ├── src │ │ ├── vite-env.d.ts │ │ ├── components │ │ │ └── HelloWorld.vue │ │ ├── App.vue │ │ ├── main.ts │ │ └── compilation.ts │ ├── README.md │ ├── tsconfig.json │ ├── vite.config.ts │ ├── index.html │ ├── tsconfig.app.json │ ├── package.json │ └── tsconfig.node.json ├── type-safe │ ├── type-annotation │ │ ├── src │ │ │ ├── locales │ │ │ │ ├── en-US.json │ │ │ │ └── schema.ts │ │ │ ├── components │ │ │ │ ├── en-US.json │ │ │ │ ├── GlobalScope.vue │ │ │ │ └── LocalScope.vue │ │ │ ├── assets │ │ │ │ └── logo.png │ │ │ ├── shims-vue.d.ts │ │ │ ├── App.vue │ │ │ └── main.ts │ │ ├── public │ │ │ └── favicon.ico │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── vite.config.ts │ │ ├── index.html │ │ ├── tsconfig.app.json │ │ ├── package.json │ │ └── tsconfig.node.json │ └── global-type-definition │ │ ├── src │ │ ├── vite-env.d.ts │ │ ├── assets │ │ │ └── logo.png │ │ ├── locales │ │ │ ├── ja-JP.json │ │ │ └── en-US.json │ │ ├── shims-vue.d.ts │ │ ├── App.vue │ │ ├── components │ │ │ └── HelloWorld.vue │ │ └── vue-i18n.d.ts │ │ ├── public │ │ └── favicon.ico │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── vite.config.ts │ │ ├── index.html │ │ ├── tsconfig.app.json │ │ ├── package.json │ │ └── tsconfig.node.json ├── frameworks │ └── nuxt3 │ │ ├── locales │ │ ├── ja.json │ │ ├── en.json │ │ └── fr.json │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ ├── app.vue │ │ ├── plugins │ │ └── i18n.ts │ │ ├── package.json │ │ ├── nuxt.config.ts │ │ └── README.md ├── composition │ └── fallback │ │ └── format.html └── petite │ └── fallback │ ├── basic.html │ └── format.html ├── .gitattributes ├── .githooks └── pre-commit ├── .npmrc ├── docs ├── public │ ├── _headers │ ├── nuxt.png │ ├── crowdin.png │ ├── decibel.png │ ├── locize.png │ ├── scope.png │ ├── RapidAPI.png │ ├── Route4Me.png │ ├── babeledit.png │ ├── sendcloud.png │ ├── microsoft.webp │ ├── nuxt3-setup.png │ ├── ts-support-1.png │ ├── ts-support-2.png │ ├── ts-support-3.gif │ ├── vuemastery.png │ ├── lifecycle2024.png │ ├── lifecycle2025.png │ ├── vue-i18n-logo.png │ ├── zenarchitects.png │ ├── lifecycle2025-1.png │ ├── lifecycle2025-2.png │ ├── nuxt3-pre-compile.png │ ├── nuxt3-setup-i18n.gif │ ├── vue-i18n-devtools-logo.png │ └── nuxt3-reduce-bundle-size.png ├── ecosystem │ └── integrations.md ├── .vitepress │ └── theme │ │ ├── integrations.ts │ │ ├── sponsors.json │ │ ├── components │ │ ├── VoltaBoard.vue │ │ ├── AsideSponsors.vue │ │ └── Service.vue │ │ ├── index.ts │ │ └── integrations.json ├── guide │ ├── migration │ │ └── breaking12.md │ └── maintenance.md └── index.md ├── assets └── vue-i18n-logo.png ├── scripts ├── build.sh ├── vitest.unit.globalSetup.ts ├── preinstall.js ├── playwright.ts ├── dist-tag.sh ├── vitest.setup.ts ├── deprecate.sh ├── release.sh ├── test-utils.ts ├── vitest.globalSetup.ts ├── postprocess.ts └── aliases.ts ├── tsconfig.typedoc.json ├── .npmignore ├── .editorconfig ├── docsgen.config.js ├── e2e ├── hotfix.spec.ts ├── number.spec.ts ├── formatting │ ├── list.spec.ts │ ├── literal.spec.ts │ ├── named.spec.ts │ └── linked.spec.ts ├── functions │ ├── list.spec.ts │ ├── named.spec.ts │ ├── plural.spec.ts │ └── linked.spec.ts ├── components │ ├── number-format.spec.ts │ ├── datetime-format.spec.ts │ └── translation.spec.ts ├── fallback │ ├── component.spec.ts │ ├── format.spec.ts │ ├── option.spec.ts │ ├── suppress.spec.ts │ └── basic.spec.ts ├── started.spec.ts ├── plural │ ├── basic.spec.ts │ └── custom.spec.ts ├── datetime.spec.ts ├── missing │ ├── option.spec.ts │ ├── suppress.spec.ts │ └── handler.spec.ts └── scope │ └── local.spec.ts ├── .prettierignore ├── .gitignore ├── vitest.e2e.config.ts ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ └── config.yml └── workflows │ ├── github-label-sync.yml │ ├── reproduire.yml │ └── nightly-release.yml ├── shim.d.ts ├── pnpm-workspace.yaml ├── vitest.unit.config.ts ├── BACKERS.md ├── .vscode └── settings.json ├── renovate.json ├── benchmark ├── compile.mjs ├── index.mjs └── utils.mjs ├── SECURITY.md ├── ARCHITECTURE.md ├── vitest.config.ts └── LICENSE /packages/core/test/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/public/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/web-components/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/src/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/lazy-loading/webpack/src/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.json linguist-language=JSON-with-Comments -------------------------------------------------------------------------------- /examples/storybook/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /examples/backend/db/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "hello!" 3 | } 4 | -------------------------------------------------------------------------------- /examples/backend/db/ja.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "こんにちは!" 3 | } 4 | -------------------------------------------------------------------------------- /.githooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | npx --no-install lint-staged 3 | -------------------------------------------------------------------------------- /examples/tsx/README.md: -------------------------------------------------------------------------------- 1 | # tsx 2 | 3 | This is an example for TSX 4 | -------------------------------------------------------------------------------- /examples/storybook/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/tsx/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/vue-i18n-core/src/plugin/index.ts: -------------------------------------------------------------------------------- 1 | export * from './types' 2 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | public-hoist-pattern[]='@vue/*' 2 | strict-peer-dependencies=false 3 | -------------------------------------------------------------------------------- /examples/ssr/vite/dep-import-type/deep/index.d.ts: -------------------------------------------------------------------------------- 1 | export interface Foo {} 2 | -------------------------------------------------------------------------------- /examples/ssr/vite/src/components/foo.css: -------------------------------------------------------------------------------- 1 | .jsx { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /docs/public/_headers: -------------------------------------------------------------------------------- 1 | https://vue-i18n-next.pages.dev/* 2 | X-Robots-Tag: noindex -------------------------------------------------------------------------------- /examples/message-format/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/web-components/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/core-base/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './utils' 2 | export * from './intl' -------------------------------------------------------------------------------- /packages/format-explorer/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | // / 2 | -------------------------------------------------------------------------------- /packages/shared/src/error.ts: -------------------------------------------------------------------------------- 1 | export interface BaseError { 2 | code: number 3 | } 4 | -------------------------------------------------------------------------------- /docs/public/nuxt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/nuxt.png -------------------------------------------------------------------------------- /docs/ecosystem/integrations.md: -------------------------------------------------------------------------------- 1 | # Third-party integrations 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/public/crowdin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/crowdin.png -------------------------------------------------------------------------------- /docs/public/decibel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/decibel.png -------------------------------------------------------------------------------- /docs/public/locize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/locize.png -------------------------------------------------------------------------------- /docs/public/scope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/scope.png -------------------------------------------------------------------------------- /examples/type-safe/type-annotation/src/locales/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "world": "the world!" 3 | } 4 | -------------------------------------------------------------------------------- /assets/vue-i18n-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/assets/vue-i18n-logo.png -------------------------------------------------------------------------------- /docs/public/RapidAPI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/RapidAPI.png -------------------------------------------------------------------------------- /docs/public/Route4Me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/Route4Me.png -------------------------------------------------------------------------------- /docs/public/babeledit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/babeledit.png -------------------------------------------------------------------------------- /docs/public/sendcloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/sendcloud.png -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /docs/public/microsoft.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/microsoft.webp -------------------------------------------------------------------------------- /docs/public/nuxt3-setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/nuxt3-setup.png -------------------------------------------------------------------------------- /docs/public/ts-support-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/ts-support-1.png -------------------------------------------------------------------------------- /docs/public/ts-support-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/ts-support-2.png -------------------------------------------------------------------------------- /docs/public/ts-support-3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/ts-support-3.gif -------------------------------------------------------------------------------- /docs/public/vuemastery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/vuemastery.png -------------------------------------------------------------------------------- /docs/public/lifecycle2024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/lifecycle2024.png -------------------------------------------------------------------------------- /docs/public/lifecycle2025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/lifecycle2025.png -------------------------------------------------------------------------------- /docs/public/vue-i18n-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/vue-i18n-logo.png -------------------------------------------------------------------------------- /docs/public/zenarchitects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/zenarchitects.png -------------------------------------------------------------------------------- /examples/frameworks/nuxt3/locales/ja.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "こんにちは、{name} !", 3 | "language": "言語" 4 | } 5 | -------------------------------------------------------------------------------- /docs/public/lifecycle2025-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/lifecycle2025-1.png -------------------------------------------------------------------------------- /docs/public/lifecycle2025-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/lifecycle2025-2.png -------------------------------------------------------------------------------- /docs/public/nuxt3-pre-compile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/nuxt3-pre-compile.png -------------------------------------------------------------------------------- /docs/public/nuxt3-setup-i18n.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/nuxt3-setup-i18n.gif -------------------------------------------------------------------------------- /examples/frameworks/nuxt3/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "Hello, {name} !", 3 | "language": "Language" 4 | } 5 | -------------------------------------------------------------------------------- /examples/frameworks/nuxt3/locales/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "Bonjour, {name} !", 3 | "language": "Langue" 4 | } 5 | -------------------------------------------------------------------------------- /examples/lazy-loading/webpack/src/pages/Home.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /examples/ssr/vitepress/README.md: -------------------------------------------------------------------------------- 1 | # virepress SSR build 2 | 3 | This is an example of vitepress SSR build (SSG). 4 | -------------------------------------------------------------------------------- /examples/tsx/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/tsx/public/favicon.ico -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | pnpm build --withTypes 6 | 7 | tsx ./scripts/postprocess.ts 8 | -------------------------------------------------------------------------------- /examples/backend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/backend/public/favicon.ico -------------------------------------------------------------------------------- /examples/lazy-loading/webpack/src/pages/About.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /docs/public/vue-i18n-devtools-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/vue-i18n-devtools-logo.png -------------------------------------------------------------------------------- /examples/backend/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/backend/src/assets/logo.png -------------------------------------------------------------------------------- /examples/frameworks/nuxt3/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log* 3 | .nuxt 4 | .nitro 5 | .cache 6 | .output 7 | .env 8 | dist 9 | -------------------------------------------------------------------------------- /examples/ssr/vite/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/ssr/vite/src/assets/logo.png -------------------------------------------------------------------------------- /examples/storybook/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/storybook/public/favicon.ico -------------------------------------------------------------------------------- /examples/web-components/README.md: -------------------------------------------------------------------------------- 1 | # web-components 2 | 3 | This is an example of how to use vue-i18n with web-components. 4 | -------------------------------------------------------------------------------- /docs/public/nuxt3-reduce-bundle-size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/docs/public/nuxt3-reduce-bundle-size.png -------------------------------------------------------------------------------- /examples/backend/db/message.d.ts: -------------------------------------------------------------------------------- 1 | import en from './en.json' with { type: 'json' } 2 | 3 | export type ResourceSchema = typeof en 4 | -------------------------------------------------------------------------------- /scripts/vitest.unit.globalSetup.ts: -------------------------------------------------------------------------------- 1 | export function setup(): void { 2 | console.log('ICU version:', process.versions.icu) 3 | } 4 | -------------------------------------------------------------------------------- /tsconfig.typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["packages/global.d.ts", "packages/*/src"] 4 | } 5 | -------------------------------------------------------------------------------- /examples/type-safe/type-annotation/src/components/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "messages": { 3 | "hello": "Hello, {name}!" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /examples/web-components/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/web-components/public/favicon.ico -------------------------------------------------------------------------------- /packages/format-explorer/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/packages/format-explorer/public/favicon.ico -------------------------------------------------------------------------------- /examples/ssr/vite/dep-import-type/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dep-import-type", 3 | "version": "0.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/format-explorer/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import App from './App.vue' 3 | 4 | createApp(App).mount('#app') 5 | -------------------------------------------------------------------------------- /packages/devtools-types/README.md: -------------------------------------------------------------------------------- 1 | # @intlify/devtools-types 2 | 3 | ## :copyright: License 4 | 5 | [MIT](http://opensource.org/licenses/MIT) 6 | -------------------------------------------------------------------------------- /packages/format-explorer/src/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/packages/format-explorer/src/assets/favicon.ico -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.log 3 | *.swp 4 | coverage 5 | test 6 | benchmark 7 | e2e 8 | temp 9 | docs 10 | types 11 | scripts 12 | .eslintcache 13 | -------------------------------------------------------------------------------- /examples/message-format/README.md: -------------------------------------------------------------------------------- 1 | # custom message format 2 | 3 | This is an example for custom message compiler with using `intl-messageformat` 4 | -------------------------------------------------------------------------------- /examples/backend/src/constants.ts: -------------------------------------------------------------------------------- 1 | // define locales 2 | export const locales = ['en', 'ja'] as const 3 | export type Locales = (typeof locales)[number] 4 | -------------------------------------------------------------------------------- /examples/ssr/vite/src/assets/fonts/Inter-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/ssr/vite/src/assets/fonts/Inter-Italic.woff -------------------------------------------------------------------------------- /examples/ssr/vite/src/assets/fonts/Inter-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/ssr/vite/src/assets/fonts/Inter-Italic.woff2 -------------------------------------------------------------------------------- /examples/type-safe/type-annotation/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/type-safe/type-annotation/public/favicon.ico -------------------------------------------------------------------------------- /examples/lazy-loading/webpack/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | -------------------------------------------------------------------------------- /examples/type-safe/type-annotation/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/type-safe/type-annotation/src/assets/logo.png -------------------------------------------------------------------------------- /packages/vue-i18n-core/README.md: -------------------------------------------------------------------------------- 1 | # vue-i18n-core 2 | 3 | Vue I18n core modules 4 | 5 | ## :copyright: License 6 | 7 | [MIT](http://opensource.org/licenses/MIT) 8 | -------------------------------------------------------------------------------- /examples/storybook/src/main.ts: -------------------------------------------------------------------------------- 1 | import './assets/main.css' 2 | 3 | import { createApp } from 'vue' 4 | import App from './App.vue' 5 | 6 | createApp(App).mount('#app') 7 | -------------------------------------------------------------------------------- /examples/tsx/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.app.json" }, 5 | { "path": "./tsconfig.node.json" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/type-safe/global-type-definition/public/favicon.ico -------------------------------------------------------------------------------- /examples/backend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.app.json" }, 5 | { "path": "./tsconfig.node.json" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /examples/ssr/vite/example-external-component/index.js: -------------------------------------------------------------------------------- 1 | import ExampleExternalComponent from './ExampleExternalComponent.vue' 2 | 3 | export default ExampleExternalComponent 4 | -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intlify/vue-i18n/HEAD/examples/type-safe/global-type-definition/src/assets/logo.png -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/src/locales/ja-JP.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "こんにちは、世界!", 3 | "menu": { 4 | "login": "ログイン" 5 | }, 6 | "errors": ["エラー!"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-base/README.md: -------------------------------------------------------------------------------- 1 | # @intlify/core-base 2 | 3 | The intlify core base module 4 | 5 | ## :copyright: License 6 | 7 | [MIT](http://opensource.org/licenses/MIT) 8 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.app.json" }, 5 | { "path": "./tsconfig.node.json" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /examples/message-format/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.app.json" }, 5 | { "path": "./tsconfig.node.json" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /examples/ssr/vite/example-external-component/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-external-component", 3 | "private": true, 4 | "version": "0.0.0", 5 | "main": "index.js" 6 | } 7 | -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/src/locales/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "hello world!", 3 | "menu": { 4 | "login": "login" 5 | }, 6 | "errors": ["Error!"] 7 | } 8 | -------------------------------------------------------------------------------- /examples/web-components/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.app.json" }, 5 | { "path": "./tsconfig.node.json" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /examples/tsx/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue' 3 | const component: DefineComponent<{}, {}, any> 4 | export default component 5 | } 6 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/README.md: -------------------------------------------------------------------------------- 1 | # lazy-loading-vite 2 | 3 | i18n locale messages lazy loading examples for Vite 4 | 5 | 6 | ## License 7 | 8 | [MIT](http://opensource.org/licenses/MIT) 9 | -------------------------------------------------------------------------------- /examples/type-safe/type-annotation/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.app.json" }, 5 | { "path": "./tsconfig.node.json" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.app.json" }, 5 | { "path": "./tsconfig.node.json" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/message-compiler/README.md: -------------------------------------------------------------------------------- 1 | # @intlify/message-compiler 2 | 3 | The message compiler for intlify project 4 | 5 | ## :copyright: License 6 | 7 | [MIT](http://opensource.org/licenses/MIT) 8 | -------------------------------------------------------------------------------- /packages/vue-i18n-core/test/errors.test.ts: -------------------------------------------------------------------------------- 1 | import { I18nErrorCodes } from '../src/errors' 2 | 3 | test('I18nErrorCodes', () => { 4 | expect(I18nErrorCodes.UNEXPECTED_RETURN_TYPE).toBe(24) 5 | }) 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /docsgen.config.js: -------------------------------------------------------------------------------- 1 | const linkReferencer = require('./scripts/api/resolver') 2 | const processor = require('./scripts/api/processor') 3 | 4 | module.exports = { 5 | linkReferencer, 6 | processor 7 | } 8 | -------------------------------------------------------------------------------- /examples/ssr/vite/README.md: -------------------------------------------------------------------------------- 1 | # SSR on Vite 2 | 3 | This is an example of SSR based on Vite. 4 | 5 | The code base is forked [vue-ssr](https://github.com/vitejs/vite/tree/main/packages/playground/ssr-vue) 6 | -------------------------------------------------------------------------------- /examples/type-safe/type-annotation/README.md: -------------------------------------------------------------------------------- 1 | # type-annotation 2 | 3 | This is one of the type-safe i18n resources examples. 4 | 5 | This example is how to usage of type annotation for i18n resources. 6 | -------------------------------------------------------------------------------- /packages/core-base/test/errors.test.ts: -------------------------------------------------------------------------------- 1 | import { CORE_ERROR_CODES_EXTEND_POINT } from '../src/errors' 2 | 3 | test('CoreErrorCodes', () => { 4 | expect(CORE_ERROR_CODES_EXTEND_POINT).toBe(24) 5 | }) 6 | -------------------------------------------------------------------------------- /packages/core-base/test/warnings.test.ts: -------------------------------------------------------------------------------- 1 | import { CORE_WARN_CODES_EXTEND_POINT } from '../src/warnings' 2 | 3 | test('CoreWarnCodes', () => { 4 | expect(CORE_WARN_CODES_EXTEND_POINT).toBe(8) 5 | }) 6 | -------------------------------------------------------------------------------- /packages/shared/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './utils' 2 | export * from './warn' 3 | export * from './error' 4 | export * from './emittable' 5 | export * from './emitter' 6 | export * from './messages' 7 | -------------------------------------------------------------------------------- /examples/type-safe/type-annotation/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue' 3 | const component: DefineComponent<{}, {}, any> 4 | export default component 5 | } 6 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/src/index.css: -------------------------------------------------------------------------------- 1 | #app { 2 | font-family: Avenir, Helvetica, Arial, sans-serif; 3 | -webkit-font-smoothing: antialiased; 4 | -moz-osx-font-smoothing: grayscale; 5 | color: #2c3e50; 6 | } 7 | -------------------------------------------------------------------------------- /examples/message-format/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import vue from '@vitejs/plugin-vue' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [vue()] 7 | }) 8 | -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue' 3 | const component: DefineComponent<{}, {}, any> 4 | export default component 5 | } 6 | -------------------------------------------------------------------------------- /examples/lazy-loading/webpack/src/index.css: -------------------------------------------------------------------------------- 1 | #app { 2 | font-family: Avenir, Helvetica, Arial, sans-serif; 3 | -webkit-font-smoothing: antialiased; 4 | -moz-osx-font-smoothing: grayscale; 5 | color: #2c3e50; 6 | } 7 | -------------------------------------------------------------------------------- /examples/storybook/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { 5 | "path": "./tsconfig.node.json" 6 | }, 7 | { 8 | "path": "./tsconfig.app.json" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /packages/shared/test/__snapshots__/utils.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`generateCodeFrame 1`] = ` 4 | "1 | hi, { 'kazupon' } 5 | | ^^^^^^^^^^^^^" 6 | `; 7 | -------------------------------------------------------------------------------- /examples/lazy-loading/webpack/README.md: -------------------------------------------------------------------------------- 1 | # :lollipop: lazy-loading-webpack 2 | 3 | i18n locale messages lazy loading examples for webpack 4 | 5 | 6 | ## :copyright: License 7 | 8 | [MIT](http://opensource.org/licenses/MIT) 9 | -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/README.md: -------------------------------------------------------------------------------- 1 | # global-type-definition 2 | 3 | This is one of the type-safe i18n resources examples. 4 | 5 | This example is how to usage of global type definition for i18n resources in global scope. 6 | -------------------------------------------------------------------------------- /examples/ssr/vite/src/components/ImportType.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 9 | -------------------------------------------------------------------------------- /examples/web-components/src/components/HelloI18n.ce.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | -------------------------------------------------------------------------------- /packages/size-check-core/README.md: -------------------------------------------------------------------------------- 1 | # Size Check for @intlify/core 2 | 3 | This package is private and is used for checking the baseline runtime size after tree shaking (with only the bare minimal code required to render something to the screen). 4 | -------------------------------------------------------------------------------- /packages/size-check-vue-i18n/README.md: -------------------------------------------------------------------------------- 1 | # Size Check for vue-i18n 2 | 3 | This package is private and is used for checking the baseline runtime size after tree shaking (with only the bare minimal code required to render something to the screen). 4 | -------------------------------------------------------------------------------- /packages/size-check-petite-vue-i18n/README.md: -------------------------------------------------------------------------------- 1 | # Size Check for vue-i18n 2 | 3 | This package is private and is used for checking the baseline runtime size after tree shaking (with only the bare minimal code required to render something to the screen). 4 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/integrations.ts: -------------------------------------------------------------------------------- 1 | import data from './integrations.json' 2 | 3 | export interface Service { 4 | title: string 5 | link: string 6 | source: string 7 | description: string 8 | } 9 | 10 | export const integrations = data 11 | -------------------------------------------------------------------------------- /examples/ssr/vite/src/entry-client.js: -------------------------------------------------------------------------------- 1 | import { createApp } from './main' 2 | 3 | const { app, router } = createApp() 4 | 5 | // wait until router is ready before mounting to ensure hydration match 6 | router.isReady().then(() => { 7 | app.mount('#app') 8 | }) 9 | -------------------------------------------------------------------------------- /examples/tsx/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import vue from '@vitejs/plugin-vue' 3 | import vueJsx from '@vitejs/plugin-vue-jsx' 4 | 5 | // https://vitejs.dev/config/ 6 | export default defineConfig({ 7 | plugins: [vue(), vueJsx()] 8 | }) 9 | -------------------------------------------------------------------------------- /scripts/preinstall.js: -------------------------------------------------------------------------------- 1 | if (!/pnpm/.test(process.env.npm_execpath || '')) { 2 | console.warn( 3 | `\u001b[33mThis repository requires using pnpm as the package manager ` + 4 | ` for scripts to work properly.\u001b[39m\n` 5 | ) 6 | process.exit(1) 7 | } 8 | -------------------------------------------------------------------------------- /packages/core/api-extractor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../api-extractor.json", 3 | "mainEntryPointFilePath": "./dist/packages//src/index.d.ts", 4 | "dtsRollup": { 5 | "publicTrimmedFilePath": "./dist/.d.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/shared/api-extractor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../api-extractor.json", 3 | "mainEntryPointFilePath": "./dist/packages//src/index.d.ts", 4 | "dtsRollup": { 5 | "publicTrimmedFilePath": "./dist/.d.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-base/api-extractor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../api-extractor.json", 3 | "mainEntryPointFilePath": "./dist/packages//src/index.d.ts", 4 | "dtsRollup": { 5 | "publicTrimmedFilePath": "./dist/.d.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/vue-i18n/api-extractor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../api-extractor.json", 3 | "mainEntryPointFilePath": "./dist/packages//src/index.d.ts", 4 | "dtsRollup": { 5 | "publicTrimmedFilePath": "./dist/.d.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/src/pages/Home.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | -------------------------------------------------------------------------------- /packages/devtools-types/api-extractor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../api-extractor.json", 3 | "mainEntryPointFilePath": "./dist/packages//src/index.d.ts", 4 | "dtsRollup": { 5 | "publicTrimmedFilePath": "./dist/.d.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/message-compiler/api-extractor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../api-extractor.json", 3 | "mainEntryPointFilePath": "./dist/packages//src/index.d.ts", 4 | "dtsRollup": { 5 | "publicTrimmedFilePath": "./dist/.d.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/petite-vue-i18n/api-extractor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../api-extractor.json", 3 | "mainEntryPointFilePath": "./dist/packages//src/index.d.ts", 4 | "dtsRollup": { 5 | "publicTrimmedFilePath": "./dist/.d.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/vue-i18n-core/api-extractor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../api-extractor.json", 3 | "mainEntryPointFilePath": "./dist/packages//src/index.d.ts", 4 | "dtsRollup": { 5 | "publicTrimmedFilePath": "./dist/.d.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/src/pages/About.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | -------------------------------------------------------------------------------- /packages/vue-i18n-core/api-extractor-petite.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../api-extractor.json", 3 | "mainEntryPointFilePath": "./dist/packages//src/petite.d.ts", 4 | "dtsRollup": { 5 | "publicTrimmedFilePath": "./dist/petite-vue-i18n-core.d.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/src/locales/ja.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": { 3 | "home": "このページはホームです。", 4 | "about": "このページはアバウトページです。" 5 | }, 6 | "navigations": { 7 | "home": "ホーム", 8 | "about": "アバウト" 9 | }, 10 | "labels": { 11 | "language": "言語" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/storybook/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}] 2 | charset = utf-8 3 | indent_size = 2 4 | indent_style = space 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | 8 | end_of_line = lf 9 | max_line_length = 100 10 | -------------------------------------------------------------------------------- /examples/lazy-loading/webpack/src/locales/ja.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": { 3 | "home": "このページはホームです。", 4 | "about": "このページはアバウトページです。" 5 | }, 6 | "navigations": { 7 | "home": "ホーム", 8 | "about": "アバウト" 9 | }, 10 | "labels": { 11 | "language": "言語" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/web-components/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue' 3 | // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types 4 | const component: DefineComponent<{}, {}, any> 5 | export default component 6 | } 7 | -------------------------------------------------------------------------------- /packages/size-check-core/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createCoreContext, translate } from '@intlify/core' 2 | 3 | const ctx = createCoreContext({ 4 | locale: 'en', 5 | messages: { 6 | en: { 7 | hello: 'hello!' 8 | } 9 | } 10 | }) 11 | 12 | console.log(translate(ctx, 'hello')) 13 | -------------------------------------------------------------------------------- /docs/guide/migration/breaking12.md: -------------------------------------------------------------------------------- 1 | # Breaking Changes in v12 2 | 3 | ## Drop Custom Directive `v-t` 4 | 5 | **Reason**: This custom directive had already deprecated in warning about being dropped in v12. docs says, https://vue-i18n.intlify.dev/guide/migration/breaking11.html#deprecate-custom-directive-v-t 6 | -------------------------------------------------------------------------------- /examples/type-safe/type-annotation/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import vue from '@vitejs/plugin-vue' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [vue()], 7 | define: { 8 | __VUE_I18N_FULL_INSTALL__: true 9 | } 10 | }) 11 | -------------------------------------------------------------------------------- /examples/ssr/vite/src/pages/External.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | -------------------------------------------------------------------------------- /examples/storybook/src/assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import vue from '@vitejs/plugin-vue' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [vue()], 7 | define: { 8 | __VUE_I18N_FULL_INSTALL__: true 9 | } 10 | }) 11 | -------------------------------------------------------------------------------- /packages/message-compiler/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './compiler' 2 | export * from './errors' 3 | export * from './helpers' 4 | export * from './location' 5 | export * from './mangler' 6 | export * from './nodes' 7 | export * from './optimizer' 8 | export * from './options' 9 | export * from './parser' 10 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/src/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": { 3 | "home": "This page is home page", 4 | "about": "This page is about page" 5 | }, 6 | "navigations": { 7 | "home": "Home", 8 | "about": "About" 9 | }, 10 | "labels": { 11 | "language": "Languages" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/lazy-loading/webpack/src/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": { 3 | "home": "This page is home page", 4 | "about": "This page is about page" 5 | }, 6 | "navigations": { 7 | "home": "Home", 8 | "about": "About" 9 | }, 10 | "labels": { 11 | "language": "Languages" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue' 3 | const component: DefineComponent<{}, {}, any> 4 | export default component 5 | } 6 | 7 | declare module '*.css' { 8 | const content: Record 9 | export default content 10 | } 11 | -------------------------------------------------------------------------------- /examples/backend/src/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | declare module '*.vue' { 4 | import { DefineComponent } from 'vue' 5 | // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types 6 | const component: DefineComponent<{}, {}, any> 7 | export default component 8 | } 9 | -------------------------------------------------------------------------------- /packages/format-explorer/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue' 3 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 4 | const component: DefineComponent<{}, {}, any> 5 | // @ts-ignore -- NOTE(kazupon): for Vue SFC style import 6 | export default component 7 | } 8 | -------------------------------------------------------------------------------- /packages/size-check-vue-i18n/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue' 3 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 4 | const component: DefineComponent<{}, {}, any> 5 | // @ts-ignore -- NOTE(kazupon): for Vue SFC types 6 | export default component 7 | } 8 | -------------------------------------------------------------------------------- /e2e/hotfix.spec.ts: -------------------------------------------------------------------------------- 1 | import { getText, url } from './helper' 2 | 3 | describe('CVE-2024-52809', () => { 4 | beforeAll(async () => { 5 | await page.goto(url(`/e2e/hotfix/CVE-2024-52809.html`)) 6 | }) 7 | 8 | test('fix', async () => { 9 | expect(await getText(page, 'p')).toMatch('hello world!') 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /packages/size-check-petite-vue-i18n/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue' 3 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 4 | const component: DefineComponent<{}, {}, any> 5 | // @ts-ignore -- NOTE(kazupon): for Vue SFC types 6 | export default component 7 | } 8 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | types 3 | docs 4 | coverage 5 | tsconfig.json 6 | api-extractor.json 7 | README.md 8 | temp 9 | e2e/hotfix/CVE-2024-52809.html 10 | packages/format-explorer/index.html 11 | packages/size-check-core/index.html 12 | packages/size-check-petite-vue-i18n/index.html 13 | packages/size-check-vue-i18n/index.html 14 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/src/vue-i18n.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * global type definitions 3 | */ 4 | 5 | import 'vue-i18n' 6 | import en from './locales/en.json' 7 | 8 | type MessageSchema = typeof en 9 | 10 | declare module 'vue-i18n' { 11 | // define the locale messages schema 12 | export interface DefineLocaleMessage extends MessageSchema {} 13 | } 14 | -------------------------------------------------------------------------------- /packages/size-check-vue-i18n/src/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 16 | -------------------------------------------------------------------------------- /examples/storybook/src/components/icons/IconSupport.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /scripts/playwright.ts: -------------------------------------------------------------------------------- 1 | async function main(): Promise { 2 | try { 3 | await import('playwright-core') 4 | } catch (e) { 5 | console.error('Playwright is not installed. Please run `pnpm playwright-core install chromium`') 6 | throw e 7 | } 8 | } 9 | 10 | main().catch(err => { 11 | console.error(err) 12 | process.exit(1) 13 | }) 14 | -------------------------------------------------------------------------------- /packages/size-check-petite-vue-i18n/src/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 16 | -------------------------------------------------------------------------------- /examples/message-format/src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | -------------------------------------------------------------------------------- /examples/storybook/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@vue/tsconfig/tsconfig.dom.json", 3 | "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], 4 | "exclude": ["src/**/__tests__/*"], 5 | "compilerOptions": { 6 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", 7 | 8 | "paths": { 9 | "@/*": ["./src/*"] 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/size-check-core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite App 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | packages/vue-i18n/index.html 3 | temp 4 | coverage 5 | node_modules 6 | .DS_Store 7 | .idea 8 | .vscode 9 | debug.log 10 | .eslintcache 11 | 12 | # VitePress related 13 | **/.vitepress/cache 14 | docs/api/general 15 | docs/api/vue 16 | docs/api/index.md 17 | !docs/api/typedoc-sidebar.json 18 | 19 | *.log 20 | *.swp 21 | *.tgz 22 | *.zip 23 | *~ 24 | .env 25 | -------------------------------------------------------------------------------- /packages/size-check-vue-i18n/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite App 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/sponsors.json: -------------------------------------------------------------------------------- 1 | { 2 | "platinum": [{ 3 | "name": "Zen Architects", 4 | "url": "https://zenarchitects.co.jp/", 5 | "img": "zenarchitects.png" 6 | }], 7 | "special": [{ 8 | "name": "PLAID", 9 | "url": "https://plaid.co.jp/", 10 | "img": "plaid.svg" 11 | }], 12 | "gold": [ 13 | ], 14 | "silver": [], 15 | "bronze": [] 16 | } 17 | -------------------------------------------------------------------------------- /packages/size-check-petite-vue-i18n/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite App 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /vitest.e2e.config.ts: -------------------------------------------------------------------------------- 1 | import config from './vitest.config' 2 | 3 | import type { ViteUserConfig } from 'vitest/config' 4 | 5 | export default { 6 | ...config, 7 | test: { 8 | ...config.test, 9 | setupFiles: ['./scripts/vitest.setup.ts'], 10 | globalSetup: ['./scripts/vitest.globalSetup.ts'], 11 | include: ['./e2e/**/*.spec.ts'] 12 | } 13 | } as ViteUserConfig 14 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Lazy loading example 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: kazupon 4 | patreon: # 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | issuehunt: # 9 | custom: # Replace with a single custom sponsorship URL 10 | -------------------------------------------------------------------------------- /examples/tsx/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import { createI18n } from 'vue-i18n' 3 | import App from './App.vue' 4 | 5 | const i18n = createI18n({ 6 | locale: 'en', 7 | messages: { 8 | en: { 9 | hello: 'Hello world', 10 | tos: 'vue-i18n docs', 11 | term: 'access to {0}' 12 | } 13 | } 14 | }) 15 | 16 | createApp(App).use(i18n).mount('#app') 17 | -------------------------------------------------------------------------------- /packages/core-base/test/schema.ts: -------------------------------------------------------------------------------- 1 | export type ResourceSchema = { 2 | foo: string 3 | nest: { 4 | bar: string 5 | } 6 | errors: string[] 7 | } 8 | 9 | export type MyDatetimeScehma = { 10 | short: { 11 | hour: 'numeric' 12 | } 13 | } 14 | 15 | export type MyNumberSchema = { 16 | currency: { 17 | style: 'currency' 18 | currencyDisplay: 'symbol' 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/message-format/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Example: Custom Message Compiler 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/vue-i18n-core/test/schema.ts: -------------------------------------------------------------------------------- 1 | export type ResourceSchema = { 2 | foo: string 3 | nest: { 4 | bar: string 5 | } 6 | errors: string[] 7 | } 8 | 9 | export type MyDatetimeScehma = { 10 | short: { 11 | hour: 'numeric' 12 | } 13 | } 14 | 15 | export type MyNumberSchema = { 16 | currency: { 17 | style: 'currency' 18 | currencyDisplay: 'symbol' 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/lazy-loading/vite/vite.config.ts: -------------------------------------------------------------------------------- 1 | import vueI18n from '@intlify/unplugin-vue-i18n/vite' 2 | import vue from '@vitejs/plugin-vue' 3 | import path from 'node:path' 4 | import { defineConfig } from 'vite' 5 | 6 | export default defineConfig({ 7 | plugins: [ 8 | vue(), 9 | vueI18n({ 10 | include: path.resolve(import.meta.dirname, './src/locales/**') 11 | }) 12 | ] 13 | }) 14 | -------------------------------------------------------------------------------- /packages/core-base/src/intl.ts: -------------------------------------------------------------------------------- 1 | export type IntlAvailability = { 2 | dateTimeFormat: boolean 3 | numberFormat: boolean 4 | } 5 | 6 | const intlDefined = typeof Intl !== 'undefined' 7 | export const Availabilities = { 8 | dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined', 9 | numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined' 10 | } as IntlAvailability 11 | -------------------------------------------------------------------------------- /shim.d.ts: -------------------------------------------------------------------------------- 1 | import type { Browser, Page } from 'playwright-core' 2 | 3 | declare global { 4 | namespace globalThis { 5 | var browser: Browser 6 | var page: Page 7 | } 8 | 9 | namespace NodeJS { 10 | interface ProcessEnv { 11 | E2E_BROWSER?: 'chromium' | 'firefox' | 'webkit' 12 | CI?: string 13 | GITHUB_ACTIONS?: string 14 | } 15 | } 16 | } 17 | 18 | export {} 19 | -------------------------------------------------------------------------------- /examples/tsx/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Discord Chat at Vue Land 4 | url: https://chat.vuejs.org/ 5 | about: For simple beginner questions, you can get quick answers from Discord 6 | - name: Questions & Discussions 7 | url: https://github.com/intlify/vue-i18n/discussions 8 | about: Use GitHub discussions for message-board style questions and discussions. 9 | -------------------------------------------------------------------------------- /examples/backend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/ssr/vite/example-external-component/ExampleExternalComponent.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 12 | 13 | 14 | en: 15 | title: Example external component content 16 | ja: 17 | title: 外部コンポーネントの例 18 | 19 | -------------------------------------------------------------------------------- /examples/storybook/.storybook/main.ts: -------------------------------------------------------------------------------- 1 | import type { StorybookConfig } from '@storybook/vue3-vite' 2 | 3 | const config: StorybookConfig = { 4 | stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], 5 | addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'], 6 | framework: { 7 | name: '@storybook/vue3-vite', 8 | options: {} 9 | } 10 | } 11 | export default config 12 | -------------------------------------------------------------------------------- /examples/storybook/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/ssr/vite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite App 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/web-components/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/size-check-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@intlify/size-check-core", 3 | "private": true, 4 | "version": "12.0.0-alpha.3", 5 | "scripts": { 6 | "build": "vite build", 7 | "check": "tsc", 8 | "dev": "vite", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "@intlify/core": "workspace:*" 13 | }, 14 | "devDependencies": { 15 | "vite": "^7.1.12" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/type-safe/type-annotation/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'packages/*' 3 | - 'examples/**/*' 4 | - '!examples/frameworks/nuxt3' 5 | minimumReleaseAge: 1440 6 | minimumReleaseAgeExclude: 7 | - '@kazupon/eslint-config' 8 | - vitest 9 | - '@vitest/mocker' 10 | - '@vitest/pretty-format' 11 | - '@vitest/snapshot' 12 | - '@vitest/spy' 13 | - '@vitest/runner' 14 | - '@vitest/expect' 15 | - '@vitest/utils' 16 | - '@vitest/coverage-v8' 17 | -------------------------------------------------------------------------------- /examples/frameworks/nuxt3/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://nuxt.com/docs/guide/concepts/typescript 3 | "files": [], 4 | "references": [ 5 | { 6 | "path": "./.nuxt/tsconfig.app.json" 7 | }, 8 | { 9 | "path": "./.nuxt/tsconfig.server.json" 10 | }, 11 | { 12 | "path": "./.nuxt/tsconfig.shared.json" 13 | }, 14 | { 15 | "path": "./.nuxt/tsconfig.node.json" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/frameworks/nuxt3/app.vue: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /examples/storybook/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { fileURLToPath, URL } from 'node:url' 2 | 3 | import { defineConfig } from 'vite' 4 | import vue from '@vitejs/plugin-vue' 5 | import vueDevTools from 'vite-plugin-vue-devtools' 6 | 7 | // https://vite.dev/config/ 8 | export default defineConfig({ 9 | plugins: [vue(), vueDevTools()], 10 | resolve: { 11 | alias: { 12 | '@': fileURLToPath(new URL('./src', import.meta.url)) 13 | } 14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /examples/web-components/src/components/HelloBlock.ce.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 13 | 14 | 15 | { 16 | "en": { 17 | "world": "The world!" 18 | }, 19 | "ja": { 20 | "world": "ザ・ワールド" 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /packages/format-explorer/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Intlify message format explorer 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/frameworks/nuxt3/plugins/i18n.ts: -------------------------------------------------------------------------------- 1 | import { createI18n } from 'vue-i18n' 2 | import en from '../locales/en.json' 3 | import fr from '../locales/fr.json' 4 | import ja from '../locales/ja.json' 5 | 6 | export default defineNuxtPlugin(({ vueApp }) => { 7 | const i18n = createI18n({ 8 | globalInjection: true, 9 | locale: 'en', 10 | messages: { 11 | en, 12 | fr, 13 | ja 14 | } 15 | }) 16 | 17 | vueApp.use(i18n) 18 | }) 19 | -------------------------------------------------------------------------------- /examples/ssr/vitepress/.vitepress/theme/index.ts: -------------------------------------------------------------------------------- 1 | import DefaultTheme from 'vitepress/theme' 2 | import { createI18n } from 'vue-i18n' 3 | 4 | export default { 5 | extends: DefaultTheme, 6 | enhanceApp({ app, router, siteData }) { 7 | const i18n = createI18n({ 8 | locale: 'en', 9 | messages: { 10 | en: { 11 | hello: 'hello world!' 12 | } 13 | } 14 | }) 15 | app.use(i18n) 16 | // ... 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/type-safe/type-annotation/src/locales/schema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * define the resource schema 3 | */ 4 | 5 | import enUS from './en-US.json' with { type: 'json' } 6 | 7 | // define the locale message schema as master 8 | export type MessageSchema = typeof enUS 9 | 10 | // define the number format schema 11 | export type NumberSchema = { 12 | currency: { 13 | style: 'currency' 14 | currencyDisplay: 'symbol' 15 | currency: string 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.github/workflows/github-label-sync.yml: -------------------------------------------------------------------------------- 1 | name: Label sync 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - .github/labels.yml 9 | - .github/workflows/github-label-sync.yml 10 | workflow_dispatch: # eslint-disable-line yml/no-empty-mapping-value 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: r7kamura/github-label-sync-action@061649dd3b80eb5bafad0316466f72962e62c300 # v0.1.0 17 | -------------------------------------------------------------------------------- /examples/backend/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 21 | -------------------------------------------------------------------------------- /examples/type-safe/global-type-definition/src/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 8 | 9 | 19 | -------------------------------------------------------------------------------- /examples/ssr/vite/src/components/Foo.jsx: -------------------------------------------------------------------------------- 1 | import { defineComponent } from 'vue' 2 | import { useI18n } from 'vue-i18n' 3 | import './foo.css' with { type: 'css' } 4 | 5 | // named exports w/ variable declaration: ok 6 | export const Foo = defineComponent({ 7 | name: 'Foo', 8 | setup() { 9 | const { t } = useI18n({ 10 | useScope: 'global', 11 | inheritLocale: true 12 | }) 13 | return () =>
{t('components.Foo')}
14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /vitest.unit.config.ts: -------------------------------------------------------------------------------- 1 | import { configDefaults } from 'vitest/config' 2 | import config from './vitest.config' 3 | 4 | import type { ViteUserConfig } from 'vitest/config' 5 | 6 | export default { 7 | ...config, 8 | test: { 9 | ...config.test, 10 | environmentMatchGlobs: [['packages/vue-i18n-core/**', 'jsdom']], 11 | globalSetup: ['./scripts/vitest.unit.globalSetup.ts'], 12 | exclude: [...configDefaults.exclude, '**/e2e/**'] 13 | } 14 | } as ViteUserConfig 15 | -------------------------------------------------------------------------------- /packages/shared/src/warn.ts: -------------------------------------------------------------------------------- 1 | export function warn(msg: string, err?: Error): void { 2 | if (typeof console !== 'undefined') { 3 | console.warn(`[intlify] ` + msg) 4 | /* istanbul ignore if */ 5 | if (err) { 6 | console.warn(err.stack) 7 | } 8 | } 9 | } 10 | 11 | const hasWarned: Record = {} 12 | 13 | export function warnOnce(msg: string): void { 14 | if (!hasWarned[msg]) { 15 | hasWarned[msg] = true 16 | warn(msg) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/components/VoltaBoard.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 |