mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-21 20:06:06 +00:00
perf: unify i18n text class in frontend
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { ReactNode } from 'react';
|
||||
import '@/i18n';
|
||||
import { I18nText } from '@/app/infra/entities/api';
|
||||
import { I18nLabel } from '@/app/infra/entities/common';
|
||||
|
||||
interface I18nProviderProps {
|
||||
children: ReactNode;
|
||||
@@ -11,10 +11,10 @@ interface I18nProviderProps {
|
||||
export default function I18nProvider({ children }: I18nProviderProps) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
export function i18nObj(i18nText: I18nText): string {
|
||||
export function i18nObj(i18nLabel: I18nLabel): string {
|
||||
const language = localStorage.getItem('langbot_language');
|
||||
if ((language === 'zh-Hans' && i18nText.zh_Hans) || !i18nText.en_US) {
|
||||
return i18nText.zh_Hans;
|
||||
if ((language === 'zh-Hans' && i18nLabel.zh_Hans) || !i18nLabel.en_US) {
|
||||
return i18nLabel.zh_Hans;
|
||||
}
|
||||
return i18nText.en_US;
|
||||
return i18nLabel.en_US;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user