@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.
26 lines (18 loc) • 613 B
text/typescript
import { DEFAULT_LANG } from '@/const/locale';
import { Locales } from '@/locales/resources';
import { isOnServerSide } from '@/utils/env';
import { GlobalState } from '../initialState';
import { systemStatus } from './systemStatus';
const language = (s: GlobalState) => systemStatus(s).language || 'auto';
const currentLanguage = (s: GlobalState) => {
const locale = language(s);
if (locale === 'auto') {
if (isOnServerSide) return DEFAULT_LANG;
return navigator.language as Locales;
}
return locale as Locales;
};
export const globalGeneralSelectors = {
currentLanguage,
language,
};