diff --git a/app/.storybook/I18nStoryWrapper.tsx b/app/.storybook/I18nStoryWrapper.tsx index e871dcd0..784b9c6f 100644 --- a/app/.storybook/I18nStoryWrapper.tsx +++ b/app/.storybook/I18nStoryWrapper.tsx @@ -8,7 +8,7 @@ import { NextIntlClientProvider } from "next-intl"; import React from "react"; import { defaultLocale, formats } from "../src/i18n/config"; -import { getMessages } from "../src/i18n/getMessages"; +import { getMessagesWithFallbacks } from "../src/i18n/getMessagesWithFallbacks"; const I18nStoryWrapper = ( Story: React.ComponentType, @@ -20,7 +20,7 @@ const I18nStoryWrapper = ( diff --git a/app/src/i18n/getMessages.ts b/app/src/i18n/getMessagesWithFallbacks.ts similarity index 91% rename from app/src/i18n/getMessages.ts rename to app/src/i18n/getMessagesWithFallbacks.ts index 93582505..25e82e7b 100644 --- a/app/src/i18n/getMessages.ts +++ b/app/src/i18n/getMessagesWithFallbacks.ts @@ -13,7 +13,9 @@ const localeToMessages = { * Get all messages for the given locale. If any translations are missing * from the current locale, the missing key will fallback to the default locale */ -export function getMessages(requestedLocale: string = defaultLocale) { +export function getMessagesWithFallbacks( + requestedLocale: string = defaultLocale +) { if (requestedLocale in localeToMessages === false) { console.error( "Unsupported locale was requested. Falling back to the default locale.", diff --git a/app/src/i18n/server.ts b/app/src/i18n/server.ts index a68446b1..b7315847 100644 --- a/app/src/i18n/server.ts +++ b/app/src/i18n/server.ts @@ -1,7 +1,7 @@ import { getRequestConfig } from "next-intl/server"; import { formats } from "./config"; -import { getMessages } from "./getMessages"; +import { getMessagesWithFallbacks } from "./getMessagesWithFallbacks"; /** * I18n config for server components. @@ -11,6 +11,6 @@ import { getMessages } from "./getMessages"; export default getRequestConfig(({ locale }) => { return { formats, - messages: getMessages(locale), + messages: getMessagesWithFallbacks(locale), }; }); diff --git a/app/tests/react-utils.tsx b/app/tests/react-utils.tsx index b439da15..fb03d32a 100644 --- a/app/tests/react-utils.tsx +++ b/app/tests/react-utils.tsx @@ -6,7 +6,7 @@ */ import { render as _render, RenderOptions } from "@testing-library/react"; import { defaultLocale, formats } from "src/i18n/config"; -import { getMessages } from "src/i18n/getMessages"; +import { getMessagesWithFallbacks } from "src/i18n/getMessagesWithFallbacks"; import { NextIntlClientProvider } from "next-intl"; @@ -18,7 +18,7 @@ const GlobalProviders = ({ children }: { children: React.ReactNode }) => { return ( {children}