mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-09-13 14:46:54 +08:00
feat: model provider refactor done
This commit is contained in:
19
app/client/core/locale.ts
Normal file
19
app/client/core/locale.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Lang, getLang } from "@/app/locales";
|
||||
|
||||
interface PlainConfig {
|
||||
[k: string]: PlainConfig | string;
|
||||
}
|
||||
|
||||
export type LocaleMap<
|
||||
TextPlainConfig extends PlainConfig,
|
||||
Default extends Lang,
|
||||
> = Partial<Record<Lang, TextPlainConfig>> & {
|
||||
[name in Default]: TextPlainConfig;
|
||||
};
|
||||
|
||||
export function getLocaleText<
|
||||
TextPlainConfig extends PlainConfig,
|
||||
DefaultLang extends Lang,
|
||||
>(textMap: LocaleMap<TextPlainConfig, DefaultLang>, defaultLang: DefaultLang) {
|
||||
return textMap[getLang()] || textMap[defaultLang];
|
||||
}
|
Reference in New Issue
Block a user