The language detector switched the few upstream-translated strings to the browser locale while every Lotus surface stayed English, producing a mixed UI. supportedLngs is now ['en']; the detector, backend and locale files stay so re-enabling is one line plus routing Lotus strings through useTranslation. Fixes #53 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
42 lines
1.7 KiB
TypeScript
42 lines
1.7 KiB
TypeScript
import i18n from 'i18next';
|
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
import Backend, { HttpBackendOptions } from 'i18next-http-backend';
|
|
import { initReactI18next } from 'react-i18next';
|
|
import { trimTrailingSlash } from './utils/common';
|
|
|
|
i18n
|
|
// i18next-http-backend
|
|
// loads translations from your server
|
|
// https://github.com/i18next/i18next-http-backend
|
|
.use(Backend)
|
|
// detect user language
|
|
// learn more: https://github.com/i18next/i18next-browser-languageDetector
|
|
.use(LanguageDetector)
|
|
// pass the i18n instance to react-i18next.
|
|
.use(initReactI18next)
|
|
// init i18next
|
|
// for all options read: https://www.i18next.com/overview/configuration-options
|
|
.init<HttpBackendOptions>({
|
|
debug: false,
|
|
fallbackLng: 'en',
|
|
// Lotus Chat is English-only for now: none of the Lotus-added UI (presence,
|
|
// calls, soundboard, decorations, seasonal settings, keyboard shortcuts help,
|
|
// etc.) is routed through useTranslation()/public/locales yet, so letting
|
|
// LanguageDetector pick a non-English browser locale produced a UI that was
|
|
// only partially translated (the ~11 upstream strings switched language,
|
|
// everything Lotus-added stayed English). Restricting supportedLngs keeps
|
|
// the detector/backend/mechanism intact (see LOTUS_FEATURES.md) so other
|
|
// languages can come back with a one-line change once Lotus strings are
|
|
// localized.
|
|
supportedLngs: ['en'],
|
|
interpolation: {
|
|
escapeValue: false, // not needed for react as it escapes by default
|
|
},
|
|
load: 'languageOnly',
|
|
backend: {
|
|
loadPath: `${trimTrailingSlash(import.meta.env.BASE_URL)}/public/locales/{{lng}}.json`,
|
|
},
|
|
});
|
|
|
|
export default i18n;
|