更新最新代码
This commit is contained in:
30
packages/locales/src/index.ts
Normal file
30
packages/locales/src/index.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
i18n,
|
||||
loadLocaleMessages,
|
||||
loadLocalesMap,
|
||||
loadLocalesMapFromDir,
|
||||
setupI18n,
|
||||
} from './i18n';
|
||||
|
||||
const $t = i18n.global.t;
|
||||
const $te = i18n.global.te;
|
||||
|
||||
export {
|
||||
$t,
|
||||
$te,
|
||||
i18n,
|
||||
loadLocaleMessages,
|
||||
loadLocalesMap,
|
||||
loadLocalesMapFromDir,
|
||||
setupI18n,
|
||||
};
|
||||
export {
|
||||
type ImportLocaleFn,
|
||||
type LocaleSetupOptions,
|
||||
type SupportedLanguagesType,
|
||||
} from './typing';
|
||||
export type { CompileError } from '@intlify/core-base';
|
||||
|
||||
export { useI18n } from 'vue-i18n';
|
||||
|
||||
export type { Locale } from 'vue-i18n';
|
||||
26
packages/locales/src/langs/en-US/common.json
Normal file
26
packages/locales/src/langs/en-US/common.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"back": "Back",
|
||||
"backToHome": "Back To Home",
|
||||
"login": "Login",
|
||||
"logout": "Logout",
|
||||
"prompt": "Prompt",
|
||||
"cancel": "Cancel",
|
||||
"confirm": "Confirm",
|
||||
"reset": "Reset",
|
||||
"noData": "No Data",
|
||||
"refresh": "Refresh",
|
||||
"loadingMenu": "Loading Menu",
|
||||
"query": "Search",
|
||||
"search": "Search",
|
||||
"enabled": "Enabled",
|
||||
"disabled": "Disabled",
|
||||
"edit": "Edit",
|
||||
"delete": "Delete",
|
||||
"deleteBatch": "Delete Batch",
|
||||
"create": "Create",
|
||||
"detail": "Detail",
|
||||
"yes": "Yes",
|
||||
"no": "No",
|
||||
"showSearchPanel": "Show search panel",
|
||||
"hideSearchPanel": "Hide search panel"
|
||||
}
|
||||
26
packages/locales/src/langs/zh-CN/common.json
Normal file
26
packages/locales/src/langs/zh-CN/common.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"back": "返回",
|
||||
"backToHome": "返回首页",
|
||||
"login": "登录",
|
||||
"logout": "退出登录",
|
||||
"prompt": "提示",
|
||||
"cancel": "取消",
|
||||
"confirm": "确认",
|
||||
"reset": "重置",
|
||||
"noData": "暂无数据",
|
||||
"refresh": "刷新",
|
||||
"loadingMenu": "加载菜单中",
|
||||
"query": "查询",
|
||||
"search": "搜索",
|
||||
"enabled": "已启用",
|
||||
"disabled": "已禁用",
|
||||
"edit": "修改",
|
||||
"delete": "删除",
|
||||
"deleteBatch": "批量删除",
|
||||
"create": "新增",
|
||||
"detail": "详情",
|
||||
"yes": "是",
|
||||
"no": "否",
|
||||
"showSearchPanel": "显示搜索面板",
|
||||
"hideSearchPanel": "隐藏搜索面板"
|
||||
}
|
||||
25
packages/locales/src/typing.ts
Normal file
25
packages/locales/src/typing.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export type SupportedLanguagesType = 'en-US' | 'zh-CN';
|
||||
|
||||
export type ImportLocaleFn = () => Promise<{ default: Record<string, string> }>;
|
||||
|
||||
export type LoadMessageFn = (
|
||||
lang: SupportedLanguagesType,
|
||||
) => Promise<Record<string, string> | undefined>;
|
||||
|
||||
export interface LocaleSetupOptions {
|
||||
/**
|
||||
* Default language
|
||||
* @default zh-CN
|
||||
*/
|
||||
defaultLocale?: SupportedLanguagesType;
|
||||
/**
|
||||
* Load message function
|
||||
* @param lang
|
||||
* @returns
|
||||
*/
|
||||
loadMessages?: LoadMessageFn;
|
||||
/**
|
||||
* Whether to warn when the key is not found
|
||||
*/
|
||||
missingWarn?: boolean;
|
||||
}
|
||||
6
packages/locales/tsconfig.json
Normal file
6
packages/locales/tsconfig.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "@vben/tsconfig/web.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user