0
Fork 0
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:
Xiao Yijun 2022-07-15 17:03:07 +08:00 committed by GitHub
parent 6c39790180
commit 6ae5e7d927
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 15 additions and 12 deletions

View 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;
};
}
}

View file

@ -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 = {

View file

@ -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';

View file

@ -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';