mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-02 21:24:20 -04:00
Fix translations type safety
This commit is contained in:
parent
7adb1cd504
commit
b453fb180c
@ -43,9 +43,10 @@ export const withTranslations = (
|
|||||||
i18next.init({
|
i18next.init({
|
||||||
...commonOptions,
|
...commonOptions,
|
||||||
lng: props.pageProps.__lang,
|
lng: props.pageProps.__lang,
|
||||||
|
fallbackLng: "en",
|
||||||
});
|
});
|
||||||
return i18next;
|
return i18next;
|
||||||
}, [props.pageProps.__lang]);
|
}, [props.pageProps.__lang, props.pageProps.__fallbackLng]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<I18nextProvider i18n={li18n}>
|
<I18nextProvider i18n={li18n}>
|
||||||
@ -59,7 +60,7 @@ export const withTranslations = (
|
|||||||
await i18n.init({
|
await i18n.init({
|
||||||
...commonOptions,
|
...commonOptions,
|
||||||
lng,
|
lng,
|
||||||
fallbackLng: ctx.router.defaultLocale || "en",
|
fallbackLng: "en",
|
||||||
});
|
});
|
||||||
props.pageProps.__lang = lng;
|
props.pageProps.__lang = lng;
|
||||||
return props;
|
return props;
|
||||||
|
@ -24,6 +24,6 @@ import type en from "../../../translations/en.json";
|
|||||||
declare module "i18next" {
|
declare module "i18next" {
|
||||||
interface CustomTypeOptions {
|
interface CustomTypeOptions {
|
||||||
returnNull: false;
|
returnNull: false;
|
||||||
resources: { translations: typeof en };
|
resources: { translation: typeof en };
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* Kyoo - A portable and vast media library solution.
|
|
||||||
* Copyright (c) Kyoo.
|
|
||||||
*
|
|
||||||
* See AUTHORS.md and LICENSE file in the project root for full license information.
|
|
||||||
*
|
|
||||||
* Kyoo is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* Kyoo is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import "i18next";
|
|
||||||
import type en from "../../../translations/en.json";
|
|
||||||
|
|
||||||
declare module "i18next" {
|
|
||||||
interface CustomTypeOptions {
|
|
||||||
returnNull: false;
|
|
||||||
resources: { translations: typeof en };
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user