-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(projects): import i18n [引入i18n]
- Loading branch information
1 parent
1b45b71
commit b632b7f
Showing
10 changed files
with
164 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { App } from 'vue'; | ||
import { createI18n } from 'vue-i18n'; | ||
import messages from './lang'; | ||
import type { LocaleKey } from './lang'; | ||
|
||
const i18n = createI18n({ | ||
locale: 'zh-CN', | ||
fallbackLocale: 'en', | ||
messages | ||
}); | ||
|
||
export function setupI18n(app: App) { | ||
app.use(i18n); | ||
} | ||
|
||
export function t(key: string) { | ||
return i18n.global.t(key); | ||
} | ||
|
||
export function setLocale(locale: LocaleKey) { | ||
i18n.global.locale = locale; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './i18n'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { LocaleMessages } from 'vue-i18n'; | ||
|
||
const locale: LocaleMessages<I18nType.Schema> = { | ||
message: { | ||
system: { | ||
title: 'SoybeanAdmin' | ||
}, | ||
routes: { | ||
dashboard: { | ||
dashboard: 'Dashboard', | ||
analysis: 'Analysis', | ||
workbench: 'Workbench' | ||
}, | ||
about: { | ||
about: 'About' | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default locale; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import zhCN from './zh-cn'; | ||
import en from './en'; | ||
|
||
const locales = { | ||
'zh-CN': zhCN, | ||
en | ||
}; | ||
|
||
export type LocaleKey = keyof typeof locales; | ||
|
||
export default locales; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { LocaleMessages } from 'vue-i18n'; | ||
|
||
const locale: LocaleMessages<I18nType.Schema> = { | ||
message: { | ||
system: { | ||
title: 'Soybean管理系统' | ||
}, | ||
routes: { | ||
dashboard: { | ||
dashboard: '仪表盘', | ||
analysis: '分析页', | ||
workbench: '工作台' | ||
}, | ||
about: { | ||
about: '关于' | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default locale; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b632b7f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
soybean-admin – ./
soybean-admin.vercel.app
soybean-admin-git-main-honghuangdc.vercel.app
soybean-admin-honghuangdc.vercel.app
www.soybean.pro
soybean.pro