update
This commit is contained in:
@@ -1,25 +1,28 @@
|
||||
// core (MUI)
|
||||
import {
|
||||
arSA as arSACore,
|
||||
frFR as frFRCore,
|
||||
viVN as viVNCore,
|
||||
zhCN as zhCNCore,
|
||||
arSA as arSACore,
|
||||
zhHK as zhHKCore,
|
||||
} from '@mui/material/locale';
|
||||
// data grid (MUI)
|
||||
import {
|
||||
arSD as arSDDataGrid,
|
||||
enUS as enUSDataGrid,
|
||||
frFR as frFRDataGrid,
|
||||
viVN as viVNDataGrid,
|
||||
zhCN as zhCNDataGrid,
|
||||
zhHK as zhHKDataGrid,
|
||||
} from '@mui/x-data-grid/locales';
|
||||
// date pickers (MUI)
|
||||
import {
|
||||
enUS as enUSDate,
|
||||
frFR as frFRDate,
|
||||
viVN as viVNDate,
|
||||
zhCN as zhCNDate,
|
||||
zhHK as zhHKDate,
|
||||
} from '@mui/x-date-pickers/locales';
|
||||
// data grid (MUI)
|
||||
import {
|
||||
enUS as enUSDataGrid,
|
||||
frFR as frFRDataGrid,
|
||||
viVN as viVNDataGrid,
|
||||
zhCN as zhCNDataGrid,
|
||||
arSD as arSDDataGrid,
|
||||
} from '@mui/x-data-grid/locales';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -74,6 +77,23 @@ export const allLangs = [
|
||||
components: { ...arSACore.components, ...arSDDataGrid.components },
|
||||
},
|
||||
},
|
||||
{
|
||||
value: 'hk',
|
||||
label: 'Hong Kong',
|
||||
countryCode: 'HK',
|
||||
adapterLocale: 'zh-hk',
|
||||
numberFormat: {
|
||||
code: 'zh-HK',
|
||||
currency: 'HKD',
|
||||
},
|
||||
systemValue: {
|
||||
components: {
|
||||
...zhHKCore.components,
|
||||
...zhHKDate,
|
||||
...zhHKDataGrid.components,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import i18next from 'i18next';
|
||||
import { getStorage } from 'minimal-shared/utils';
|
||||
import resourcesToBackend from 'i18next-resources-to-backend';
|
||||
import LanguageDetector from 'i18next-browser-languagedetector/cjs';
|
||||
import resourcesToBackend from 'i18next-resources-to-backend';
|
||||
import { getStorage } from 'minimal-shared/utils';
|
||||
import { initReactI18next, I18nextProvider as Provider } from 'react-i18next';
|
||||
|
||||
import { i18nOptions, fallbackLng } from './locales-config';
|
||||
import { isDev } from 'src/constants';
|
||||
import { fallbackLng, i18nOptions } from './locales-config';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -19,7 +19,11 @@ i18next
|
||||
.use(LanguageDetector)
|
||||
.use(initReactI18next)
|
||||
.use(resourcesToBackend((lang: string, ns: string) => import(`./langs/${lang}/${ns}.json`)))
|
||||
.init({ ...i18nOptions(lng), detection: { caches: ['localStorage'] } });
|
||||
.init({
|
||||
...i18nOptions(lng),
|
||||
detection: { caches: ['localStorage'] },
|
||||
debug: isDev,
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
|
@@ -2,5 +2,6 @@
|
||||
"demo": {
|
||||
"lang": "Chinese",
|
||||
"description": "您的下一个项目的起点基于 MUI。简单的定制可帮助您更快、更好地构建应用程序。"
|
||||
}
|
||||
},
|
||||
"new-product": "新產品"
|
||||
}
|
||||
|
62
03_source/frontend/src/locales/langs/hk/common.json
Executable file
62
03_source/frontend/src/locales/langs/hk/common.json
Executable file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"demo": {
|
||||
"lang": "中文",
|
||||
"description": "您下一個項目的起點基於 MUI。簡單的定制可幫助您更快、更好地構建應用程序。"
|
||||
},
|
||||
"new-product": "新產品",
|
||||
"back": "返回",
|
||||
"App": "應用程式",
|
||||
"Ecommerce": "電子商務",
|
||||
"Analytics": "分析",
|
||||
"Banking": "銀行",
|
||||
"Booking": "預訂",
|
||||
"File": "文件",
|
||||
"Course": "課程",
|
||||
"User": "用戶",
|
||||
"Product": "產品",
|
||||
"Order": "訂單",
|
||||
"Invoice": "發票",
|
||||
"Blog": "博客",
|
||||
"Job": "工作",
|
||||
"Tour": "旅遊",
|
||||
"manager": "管理員",
|
||||
"Mail": "郵件",
|
||||
"Chat": "聊天",
|
||||
"Calendar": "日曆",
|
||||
"Kanban": "看板",
|
||||
"Permission": "權限",
|
||||
"Level": "級別",
|
||||
"Disabled": "禁用",
|
||||
"Label": "標籤",
|
||||
"Caption": "標題",
|
||||
"Params": "參數",
|
||||
"link": "鏈接",
|
||||
"Blank": "空白",
|
||||
"File-manager": "文件管理器",
|
||||
"External-link": "外部鏈接",
|
||||
"Profile": "個人資料",
|
||||
"Cards": "卡片",
|
||||
"List": "列表",
|
||||
"Create": "創建",
|
||||
"Edit": "編輯",
|
||||
"Account": "賬戶",
|
||||
"Details": "詳情",
|
||||
"Create-at": "創建於",
|
||||
"Category": "分類",
|
||||
"Stock": "庫存",
|
||||
"Price": "價格",
|
||||
"Publish": "發布",
|
||||
"in stock": "有貨",
|
||||
"low stock": "低庫存",
|
||||
"out of stock": "缺貨",
|
||||
"In stock": "有貨",
|
||||
"Low stock": "低庫存",
|
||||
"Out of stock": "缺貨",
|
||||
"Published": "已發布",
|
||||
"Draft": "草稿",
|
||||
"published": "已發布",
|
||||
"draft": "草稿",
|
||||
"Dashboard": "儀表板",
|
||||
"Apply": "應用",
|
||||
"hello": "world"
|
||||
}
|
12
03_source/frontend/src/locales/langs/hk/navbar.json
Executable file
12
03_source/frontend/src/locales/langs/hk/navbar.json
Executable file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"app": "應用",
|
||||
"job": "工作",
|
||||
"user": "用戶",
|
||||
"travel": "旅行",
|
||||
"invoice": "發票",
|
||||
"blog": {
|
||||
"title": "部落格",
|
||||
"caption": "自定義鍵盤快捷鍵。"
|
||||
},
|
||||
"subheader": "子標題"
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export const fallbackLng = 'en';
|
||||
export const languages = ['en', 'fr', 'vi', 'cn', 'ar'];
|
||||
export const languages = ['en', 'fr', 'vi', 'cn', 'ar', 'hk'];
|
||||
export const defaultNS = 'common';
|
||||
|
||||
export type LanguageValue = (typeof languages)[number];
|
||||
@@ -51,4 +51,9 @@ export const changeLangMessages: Record<
|
||||
error: 'خطأ في تغيير اللغة!',
|
||||
loading: 'جارٍ التحميل...',
|
||||
},
|
||||
hk: {
|
||||
success: '語言已更改!',
|
||||
error: '更改語言時出錯!',
|
||||
loading: '加載中...',
|
||||
},
|
||||
};
|
||||
|
@@ -3,12 +3,9 @@ import 'dayjs/locale/vi';
|
||||
import 'dayjs/locale/fr';
|
||||
import 'dayjs/locale/zh-cn';
|
||||
import 'dayjs/locale/ar-sa';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
||||
import { LocalizationProvider as Provider } from '@mui/x-date-pickers/LocalizationProvider';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import { useTranslate } from './use-locales';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@@ -1,12 +1,9 @@
|
||||
import dayjs from 'dayjs';
|
||||
import { useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { toast } from 'src/components/snackbar';
|
||||
|
||||
import { allLangs } from './all-langs';
|
||||
import { fallbackLng, changeLangMessages as messages } from './locales-config';
|
||||
|
||||
import type { LanguageValue } from './locales-config';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user