mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 16:13:15 +00:00
Complete Estonian translation (every key in en), wired into the locale list, the message loaders, the language switcher (with an Estonian flag drawn in the Twemoji style, since Twemoji's set is not used for it) and the locale-count test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
36 lines
1.7 KiB
TypeScript
36 lines
1.7 KiB
TypeScript
import { defineRouting } from 'next-intl/routing';
|
|
|
|
// Locale prefix mode can be configured via NEXT_PUBLIC_LOCALE_PREFIX.
|
|
// - "never" (default): /settings - locale from cookie/Accept-Language
|
|
// - "always": /en/settings - locale always in the URL
|
|
// - "as-needed": /settings for default locale, /fr/settings otherwise
|
|
// When proxying Bulwark under a sub-path (NEXT_PUBLIC_BASE_PATH), "always" is
|
|
// recommended to avoid next-intl rewrite loops caused by locale detection
|
|
// conflicting with the proxy's path rewriting.
|
|
const localePrefix = (process.env.NEXT_PUBLIC_LOCALE_PREFIX ?? 'never') as
|
|
| 'never'
|
|
| 'always'
|
|
| 'as-needed';
|
|
|
|
const SUPPORTED_LOCALES = ['ar', 'ca', 'cs', 'da', 'de', 'en', 'es', 'et', 'fa', 'fr', 'he', 'hu', 'it', 'ja', 'ko', 'lv', 'mn', 'nb', 'nl', 'pl', 'pt', 'ro', 'ru', 'sk', 'tr', 'uk', 'zh', 'zh-TW'] as const;
|
|
|
|
// Fallback locale used when the visitor's Accept-Language header does not
|
|
// match any supported locale (and no NEXT_LOCALE cookie is set yet). Admins
|
|
// set this via NEXT_PUBLIC_DEFAULT_LOCALE at build time to localise greenfield
|
|
// deployments without having every user change their preference manually.
|
|
const envDefaultLocale = process.env.NEXT_PUBLIC_DEFAULT_LOCALE?.trim();
|
|
const resolvedDefaultLocale =
|
|
envDefaultLocale && (SUPPORTED_LOCALES as readonly string[]).includes(envDefaultLocale)
|
|
? (envDefaultLocale as (typeof SUPPORTED_LOCALES)[number])
|
|
: 'en';
|
|
|
|
export const routing = defineRouting({
|
|
locales: SUPPORTED_LOCALES,
|
|
defaultLocale: resolvedDefaultLocale,
|
|
localePrefix
|
|
});
|
|
|
|
export const locales = routing.locales;
|
|
export const defaultLocale = routing.defaultLocale;
|
|
export type Locale = (typeof locales)[number];
|