feat(i18n): static type on i18n (#2225)

This commit is contained in:
Himself65
2023-05-04 00:35:09 -05:00
committed by GitHub
parent 66c3b09c67
commit 3d43e61087
80 changed files with 585 additions and 444 deletions
+6 -2
View File
@@ -4,7 +4,7 @@ import {
I18nextProvider,
initReactI18next,
Trans,
useTranslation,
useTranslation as useRootTranslation,
} from 'react-i18next';
import { LOCALES } from './resources';
@@ -38,7 +38,11 @@ declare module 'react-i18next' {
const STORAGE_KEY = 'i18n_lng';
export { I18nextProvider, LOCALES, Trans, useTranslation };
export { I18nextProvider, LOCALES, Trans };
export function useI18N() {
const { i18n } = useRootTranslation();
return i18n;
}
const resources = LOCALES.reduce<Resource>(
(acc, { tag, res }) => ({ ...acc, [tag]: { translation: res } }),
+3
View File
@@ -8,6 +8,8 @@
"It takes up more space on your device": {
"": "It takes up more space on your device."
},
"Synced with AFFiNE Cloud": "Synced with AFFiNE Cloud",
"Successfully deleted": "Successfully deleted",
"Export AFFiNE backup file": "Export AFFiNE backup file",
"Saved then enable AFFiNE Cloud": "All changes are saved locally, click to enable AFFiNE Cloud.",
"Not now": "Not now",
@@ -95,6 +97,7 @@
"Quick search placeholder": "Quick Search...",
"Quick search placeholder2": "Search in {{workspace}}",
"Settings": "Settings",
"Recent": "Recent",
"recommendBrowser": " We recommend the <1>Chrome</1> browser for optimal experience.",
"upgradeBrowser": "Please upgrade to the latest version of Chrome for the best experience.",
"Invite Members": "Invite Members",