fix(deps): update dependency next-intl to v4 (#2580)
* fix(deps): update dependency next-intl to v4 * fix: typecheck issue * refactor: implement improvements for next-intl v4 * fix: typecheck issues * fix: typecheck issue --------- Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com> Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
committed by
GitHub
parent
47ebc66c9e
commit
f55d8a9c2e
@@ -2,18 +2,26 @@
|
||||
|
||||
import { useMessages, useTranslations } from "next-intl";
|
||||
|
||||
import type { TranslationObject } from "../type";
|
||||
import type { SupportedLanguage } from "../config";
|
||||
import type englishTranslation from "../lang/en.json";
|
||||
|
||||
export { useChangeLocale } from "./use-change-locale";
|
||||
export { useCurrentLocale } from "./use-current-locale";
|
||||
|
||||
declare module "next-intl" {
|
||||
interface AppConfig {
|
||||
Messages: typeof englishTranslation;
|
||||
Locale: SupportedLanguage;
|
||||
}
|
||||
}
|
||||
|
||||
export const { useI18n, useScopedI18n } = {
|
||||
useI18n: useTranslations,
|
||||
useScopedI18n: useTranslations,
|
||||
};
|
||||
|
||||
export const { useI18nMessages } = {
|
||||
useI18nMessages: () => useMessages() as TranslationObject,
|
||||
useI18nMessages: () => useMessages(),
|
||||
};
|
||||
|
||||
export { useTranslations };
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { useLocale } from "next-intl";
|
||||
|
||||
import type { SupportedLanguage } from "../config";
|
||||
|
||||
export const useCurrentLocale = () => useLocale() as SupportedLanguage;
|
||||
export const useCurrentLocale = useLocale;
|
||||
|
||||
@@ -3594,7 +3594,7 @@
|
||||
},
|
||||
"delete": {
|
||||
"title": "Delete search engine",
|
||||
"message": "Are you sure you want to delete the search engine '{name}'?",
|
||||
"message": "Are you sure you want to delete the search engine {name}?",
|
||||
"notification": {
|
||||
"success": {
|
||||
"title": "Search engine deleted",
|
||||
|
||||
@@ -22,7 +22,7 @@ export default getRequestConfig(async ({ requestLocale }) => {
|
||||
if (currentLocale !== fallbackLocale) {
|
||||
const fallbackMessages = (await languageMap[fallbackLocale]()).default;
|
||||
return {
|
||||
locale: currentLocale,
|
||||
locale: typedLocale,
|
||||
messages: deepmerge(fallbackMessages, currentMessages),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ export const createRouting = (defaultLocale: SupportedLanguage) =>
|
||||
defaultLocale,
|
||||
localeCookie: {
|
||||
name: localeCookieKey,
|
||||
// 1 year
|
||||
maxAge: 60 * 60 * 24 * 365,
|
||||
},
|
||||
localePrefix: {
|
||||
mode: "never", // Rewrite the URL with locale parameter but without shown in url
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
import { getTranslations } from "next-intl/server";
|
||||
|
||||
import type { SupportedLanguage } from "./config";
|
||||
import type englishTranslation from "./lang/en.json";
|
||||
|
||||
declare module "next-intl" {
|
||||
interface AppConfig {
|
||||
Messages: typeof englishTranslation;
|
||||
Locale: SupportedLanguage;
|
||||
}
|
||||
}
|
||||
|
||||
export const { getI18n, getScopedI18n } = {
|
||||
getI18n: getTranslations,
|
||||
getScopedI18n: getTranslations,
|
||||
|
||||
Reference in New Issue
Block a user