mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-05 00:19:56 +08:00
Align frontend model-output language propagation and eliminate Simplified-Chinese-only UI shortcuts across chat, settings, books, reading, memory, and workspace surfaces: - Preserve Traditional Chinese (zh-tw/zh-hk/zh-mo/zh-hant) and native aliases in resolveResponseLanguage(), and introduce shared effectiveResponseLanguage() and subscribeResponseLanguage() helpers. - Sync response_language with language in SettingsStore when both were aligned, while preserving intentional divergence and clearing auto-synced pending response_language if an external desktop menu overrides language. - Preserve per-conversation replyLanguageOverride when regenerating without a replay snapshot and subscribe ChatWorkspace's default reply-language label to live response_language changes. - Route Book Creator, Book Chat fallback, Memory evolution/update, and Reading extension actions through effectiveResponseLanguage() instead of the UI language, and preserve zh-Hant in translationTarget(). - Route remaining zh ? ... : t(...) branches, hardcoded Memory labels, and binary zh/en date formatting through i18next and normalizeLanguage() so Traditional Chinese and all non-Simplified locales render through catalogs without modifying locale JSON files. Related to #2933 Related to #684
58 lines
1.5 KiB
TypeScript
58 lines
1.5 KiB
TypeScript
"use client";
|
|
|
|
/**
|
|
* Reply-language picker shared by the partner wizard and the partner
|
|
* configuration panel.
|
|
*
|
|
* An empty value means "follow the account's model output language". The
|
|
* label spells that language out instead of hardcoding English, so a user who
|
|
* selected French in Settings sees "Auto (Français)" here.
|
|
*/
|
|
|
|
import { useSyncExternalStore } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import {
|
|
readStoredResponseLanguage,
|
|
subscribeResponseLanguage,
|
|
} from "@/context/app-shell-storage";
|
|
import { RESPONSE_LANGUAGE_OPTIONS } from "@/features/settings/store/response-language-options";
|
|
|
|
export default function PartnerReplyLanguageSelect({
|
|
value,
|
|
onChange,
|
|
className,
|
|
}: {
|
|
value: string;
|
|
onChange: (value: string) => void;
|
|
className?: string;
|
|
}) {
|
|
const { t } = useTranslation();
|
|
const responseLanguage = useSyncExternalStore(
|
|
subscribeResponseLanguage,
|
|
readStoredResponseLanguage,
|
|
() => "en" as const,
|
|
);
|
|
const autoLabel =
|
|
RESPONSE_LANGUAGE_OPTIONS.find(
|
|
(option) => option.value === responseLanguage,
|
|
)?.label ?? "English";
|
|
|
|
return (
|
|
<select
|
|
value={value}
|
|
onChange={(event) => onChange(event.target.value)}
|
|
className={className}
|
|
>
|
|
<option value="">
|
|
{t("Auto ({{value}})", { value: autoLabel })}
|
|
</option>
|
|
{RESPONSE_LANGUAGE_OPTIONS.map((option) => (
|
|
<option key={option.value} value={option.value}>
|
|
{option.label}
|
|
</option>
|
|
))}
|
|
</select>
|
|
);
|
|
}
|