Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add vue-i18n support (fixes #545) #769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
Lingchen111 wants to merge 2 commits into vuejs:main
base: main
Choose a base branch
Loading
from Lingchen111:feature/issue-545
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions __test__/sortDependencies.spec.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('sortDependencies', () => {
'eslint-plugin-cypress': '^2.15.1',
'eslint-plugin-vue': '^9.17.0',
vitest: '^0.34.6',
'vue-i18n': '^11.1.7',
},
}
expect(sortDependencies(packageJson)).toStrictEqual({
Expand All @@ -41,6 +42,7 @@ describe('sortDependencies', () => {
'start-server-and-test': '^2.0.1',
vite: '^4.4.11',
vitest: '^0.34.6',
'vue-i18n': '^11.1.7',
},
})
})
Expand Down
21 changes: 20 additions & 1 deletion index.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const FEATURE_FLAGS = [
'eslint-with-prettier',
'oxlint',
'rolldown-vite',
'i18n',
] as const

const FEATURE_OPTIONS = [
Expand Down Expand Up @@ -77,6 +78,10 @@ const FEATURE_OPTIONS = [
value: 'prettier',
label: language.needsPrettier.message,
},
{
value: 'i18n',
label: language.needsVueI18n.message,
},
] as const
const EXPERIMENTAL_FEATURE_OPTIONS = [
{
Expand Down Expand Up @@ -176,6 +181,8 @@ Available feature flags:
Add Vue Router for SPA development.
--pinia
Add Pinia for state management.
--i18n
Add Vue I18n for internationalization.
--vitest
Add Vitest for unit testing.
--cypress
Expand Down Expand Up @@ -353,6 +360,7 @@ async function init() {
const needsJsx = argv.jsx || features.includes('jsx')
const needsRouter = argv.router || argv['vue-router'] || features.includes('router')
const needsPinia = argv.pinia || features.includes('pinia')
const needsVueI18n = argv.i18n || features.includes('i18n')
const needsVitest = argv.vitest || argv.tests || features.includes('vitest')
const needsEslint = argv.eslint || argv['eslint-with-prettier'] || features.includes('eslint')
const needsPrettier =
Expand Down Expand Up @@ -406,6 +414,9 @@ async function init() {
if (needsPinia) {
render('config/pinia')
}
if (needsVueI18n) {
render('config/vue-i18n')
}
if (needsVitest) {
render('config/vitest')
}
Expand Down Expand Up @@ -524,12 +535,20 @@ async function init() {
render(`code/${codeTemplate}`)

// Render entry file (main.js/ts).
if (needsPinia && needsRouter) {
if (needsPinia && needsRouter && needsVueI18n) {
render('entry/pinia-router-and-i18n')
} else if (needsRouter && needsVueI18n) {
render('entry/router-and-i18n')
} else if (needsPinia && needsVueI18n) {
render('entry/pinia-and-i18n')
} else if (needsPinia && needsRouter) {
render('entry/router-and-pinia')
} else if (needsPinia) {
render('entry/pinia')
} else if (needsRouter) {
render('entry/router')
} else if (needsVueI18n) {
render('entry/i18n')
} else {
render('entry/default')
}
Expand Down
3 changes: 3 additions & 0 deletions locales/en-US.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
"needsRolldownVite": {
"message": "rolldown-vite (experimental)"
},
"needsVueI18n": {
"message": "Add Vue I18n for internationalization?"
},
"errors": {
"operationCancelled": "Operation cancelled"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/fr-FR.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
"needsRolldownVite": {
"message": "rolldown-vite (expérimental)"
},
"needsVueI18n": {
"message": "Ajouter Vue I18n pour l'internationalisation\u00a0?"
},
"errors": {
"operationCancelled": "Operation annulée"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/tr-TR.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
"needsRolldownVite": {
"message": "rolldown-vite (deneysel)"
},
"needsVueI18n": {
"message": "Uluslararasılaştırma için Vue I18n eklensin mi?"
},
"errors": {
"operationCancelled": "İşlem iptal edildi"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/zh-Hans.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
"needsRolldownVite": {
"message": "rolldown-vite(试验阶段)"
},
"needsVueI18n": {
"message": "是否引入 Vue I18n 用于国际化?"
},
"errors": {
"operationCancelled": "操作取消"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/zh-Hant.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
"needsRolldownVite": {
"message": "rolldown-vite(試驗性功能)"
},
"needsVueI18n": {
"message": "是否引入 Vue I18n 用於國際化?"
},
"errors": {
"operationCancelled": "操作取消"
},
Expand Down
Loading
Loading

AltStyle によって変換されたページ (->オリジナル) /