@lobehub/chat
Version:
Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.
16 lines (10 loc) • 444 B
text/typescript
import { changeLanguage } from 'i18next';
import { LOBE_LOCALE_COOKIE } from '@/const/locale';
import { LocaleMode } from '@/types/locale';
import { setCookie } from './cookie';
export const switchLang = (locale: LocaleMode) => {
const lang = locale === 'auto' ? navigator.language : locale;
changeLanguage(lang);
document.documentElement.lang = lang;
setCookie(LOBE_LOCALE_COOKIE, locale === 'auto' ? undefined : locale, 365);
};