Skip to content

Commit 0a3e3db

Browse files
committed
update lazy-loading examples
1 parent c38bf83 commit 0a3e3db

File tree

13 files changed

+565
-292
lines changed

13 files changed

+565
-292
lines changed
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
22
"name": "lazy-loading-vite",
33
"version": "0.0.0",
4-
"private": true,
54
"scripts": {
6-
"dev": "vite",
7-
"build": "vite build"
5+
"build": "vite build",
6+
"dev": "vite"
87
},
98
"dependencies": {
10-
"vue": "^3.0.2",
11-
"vue-i18n": "^9.0.0-beta.6",
12-
"vue-router": "^4.0.0-rc.2"
9+
"vue": "^3.0.4",
10+
"vue-i18n": "^9.0.0-beta.16",
11+
"vue-router": "^4.0.1"
1312
},
1413
"devDependencies": {
15-
"@vue/compiler-sfc": "^3.0.2",
16-
"vite": "^1.0.0-rc.4"
17-
}
14+
"@vue/compiler-sfc": "^3.0.4",
15+
"@intlify/vite-plugin-vue-i18n": "^1.0.0-beta.4",
16+
"vite": "^1.0.0-rc.13"
17+
},
18+
"private": true
1819
}

examples/lazy-loading/vite/src/i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function setI18nLanguage(i18n: I18n, locale: Locale): void {
2626
export async function loadLocaleMessages(i18n: I18n, locale: Locale) {
2727
// load locale messages
2828
if (!i18n.global.availableLocales.includes(locale)) {
29-
const messages = await import(`./locales/${locale}.js`)
29+
const messages = await import(`./locales/${locale}.yaml`)
3030
i18n.global.setLocaleMessage(locale, messages.default)
3131
}
3232
}

examples/lazy-loading/vite/src/locales/en.js

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pages:
2+
home: 'This page is home page'
3+
about: 'This page is about page'
4+
navigations:
5+
home: 'Home'
6+
about: 'About'
7+
labels:
8+
language: 'Languages'

examples/lazy-loading/vite/src/locales/ja.js

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pages:
2+
home: 'このページはホームです。'
3+
about: 'このページはアバウトページです。'
4+
navigations:
5+
home: 'ホーム'
6+
about: 'アバウト'
7+
labels:
8+
language: '言語'

examples/lazy-loading/vite/src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import App from './App.vue'
33
import './index.css'
44
import { setupRouter } from './router'
55
import { setupI18n } from './i18n'
6-
import en from './locales/en'
6+
import en from './locales/en.yaml'
77

88
const i18n = setupI18n({
9+
globalInjection: true,
910
legacy: false,
1011
locale: 'en',
1112
fallbackLocale: 'en',
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import path from 'path'
2+
import { pluginI18n } from '@intlify/vite-plugin-vue-i18n'
3+
4+
import type { UserConfig } from 'vite'
5+
6+
const config: UserConfig = {
7+
plugins: [
8+
pluginI18n({
9+
include: path.resolve(__dirname, './src/locales/**')
10+
})
11+
]
12+
}
13+
14+
export default config

0 commit comments

Comments
 (0)