Skip to content

Commit

Permalink
refactor: setting i18n files by default using environment variables (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-w committed Jun 4, 2024
1 parent 67adfbb commit e9ff45c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions apps/nextjs-app/.env
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ SOCKET_PORT=3000

BRAND_NAME=Teable
API_DOC_ENABLED_SNIPPET=true

I18NEXT_DEFAULT_CONFIG_PATH=${NEXTJS_DIR}/next-i18next.config.js
5 changes: 1 addition & 4 deletions apps/nextjs-app/src/lib/i18n/getServerSideTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
import type { SSRConfig, UserConfig } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import type { I18nNamespace } from '@/lib/i18n/I18nNamespace.types';
import nextI18nextConfig from '../../../next-i18next.config.js';

export const getServerSideTranslations = async (
locale: string,
namespacesRequired?: I18nNamespace[] | I18nNamespace | undefined,
configOverride?: UserConfig | null,
extraLocales?: string[] | false
): Promise<SSRConfig> => {
const config = configOverride ?? nextI18nextConfig;

return serverSideTranslations(locale, namespacesRequired, config, extraLocales);
return serverSideTranslations(locale, namespacesRequired, configOverride, extraLocales);
};

0 comments on commit e9ff45c

Please sign in to comment.