mirror of
https://github.com/logto-io/logto.git
synced 2025-03-24 22:41:28 -05:00
feat(console): add a declaration file for react-i18next
(#1556)
This commit is contained in:
parent
6c39790180
commit
6ae5e7d927
56 changed files with 15 additions and 12 deletions
11
packages/console/src/i18n/react-i18next.d.ts
vendored
Normal file
11
packages/console/src/i18n/react-i18next.d.ts
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { Translation, Errors } from '@logto/phrases';
|
||||
import { CustomTypeOptions } from 'react-i18next';
|
||||
|
||||
declare module 'react-i18next' {
|
||||
interface CustomTypeOptions {
|
||||
resources: {
|
||||
translation: Translation;
|
||||
errors: Errors;
|
||||
};
|
||||
}
|
||||
}
|
|
@ -5,9 +5,11 @@ import zhCN from './locales/zh-cn';
|
|||
import { Resource, Language } from './types';
|
||||
|
||||
export { Language } from './types';
|
||||
export type LogtoErrorCode = NormalizeKeyPaths<typeof en.errors>;
|
||||
export type Translation = typeof en.translation;
|
||||
export type Errors = typeof en.errors;
|
||||
export type LogtoErrorCode = NormalizeKeyPaths<Errors>;
|
||||
export type LogtoErrorI18nKey = `errors:${LogtoErrorCode}`;
|
||||
export type I18nKey = NormalizeKeyPaths<typeof en.translation>;
|
||||
export type I18nKey = NormalizeKeyPaths<Translation>;
|
||||
export type AdminConsoleKey = NormalizeKeyPaths<typeof en.translation.admin_console>;
|
||||
|
||||
const resource: Resource = {
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
/**
|
||||
* Note: we need to re-export the locale under this `locales` folder,
|
||||
* otherwise the `useTranslation` function will cause a `Type instantiation` error (ts2589).
|
||||
*/
|
||||
export { default } from '../languages/en';
|
|
@ -1,5 +0,0 @@
|
|||
/**
|
||||
* Note: we need to re-export the locale under this `locales` folder,
|
||||
* otherwise the `useTranslation` function will cause a `Type instantiation` error (ts2589).
|
||||
*/
|
||||
export { default } from '../languages/zh-cn';
|
Loading…
Add table
Reference in a new issue