feat: 添加移动端下拉菜单和主题色设置

- 新增 MobileMenu 组件,小屏幕使用汉堡菜单替代多个按钮
- 重构 LanguageSettings 为统一下拉框样式
- 新增设置页面,支持主题色切换
- 翻译页添加源语言选择器
- 更新 8 种语言的 i18n 翻译
This commit is contained in:
2026-03-10 13:44:52 +08:00
parent 6b9fba254d
commit abcae1b8d1
22 changed files with 877 additions and 177 deletions

View File

@@ -14,6 +14,7 @@ const schemaActionInputTranslateText = z.object({
forceRetranslate: z.boolean().optional().default(false),
needIpa: z.boolean().optional().default(true),
userId: z.string().optional(),
sourceLanguage: z.string().min(LENGTH_MIN_LANGUAGE).max(LENGTH_MAX_LANGUAGE).optional(),
});
export type ActionInputTranslateText = z.infer<typeof schemaActionInputTranslateText>;

View File

@@ -6,6 +6,7 @@ export type ServiceInputTranslateText = {
forceRetranslate: boolean;
needIpa: boolean;
userId?: string;
sourceLanguage?: string;
};
export type ServiceOutputTranslateText = TSharedTranslationResult;

View File

@@ -8,7 +8,7 @@ const log = createLogger("translator-service");
export const serviceTranslateText = async (
dto: ServiceInputTranslateText
): Promise<ServiceOutputTranslateText> => {
const { sourceText, targetLanguage, forceRetranslate, needIpa, userId } = dto;
const { sourceText, targetLanguage, forceRetranslate, needIpa, userId, sourceLanguage } = dto;
// Check for existing translation
const lastTranslation = await repoSelectLatestTranslation({
@@ -21,7 +21,8 @@ export const serviceTranslateText = async (
const response = await executeTranslation(
sourceText,
targetLanguage,
needIpa
needIpa,
sourceLanguage
);
// Save translation history asynchronously (don't block response)