配方卡片英文翻译 #15

Closed
opened 2026-04-08 19:54:29 +00:00 by hera · 1 comment
Owner

修改英文翻译的时候,点击保存一下,应该真的保存好,下次打开就是我修改过的内容才对

修改英文翻译的时候,点击保存一下,应该真的保存好,下次打开就是我修改过的内容才对
Collaborator

PR 提交好了 👉 #16


根本原因applyTranslation() 调用后端时只提交了 en_name(配方名),精油的自定义英文名 customOilNameEn 根本没有持久化,每次 onMounted 都从静态翻译表重置。

修改了 4 个文件

文件 改动
backend/database.py recipes 表新增 en_oils 列(JSON 字符串,存精油译名 map)
backend/main.py RecipeUpdateen_oils 字段;update 端点写入 DB;SELECT / _recipe_to_dict 补上该字段
frontend/src/stores/recipes.js store 映射 en_oils 字段
frontend/src/components/RecipeDetailOverlay.vue 保存时同时提交 en_oils;加载时优先用已保存的译名,再 fallback 静态表
PR 提交好了 👉 https://git.euphon.cloud/hera/oil-formula-calculator/pulls/16 --- **根本原因**:`applyTranslation()` 调用后端时只提交了 `en_name`(配方名),精油的自定义英文名 `customOilNameEn` 根本没有持久化,每次 `onMounted` 都从静态翻译表重置。 **修改了 4 个文件**: | 文件 | 改动 | |------|------| | `backend/database.py` | `recipes` 表新增 `en_oils` 列(JSON 字符串,存精油译名 map) | | `backend/main.py` | `RecipeUpdate` 加 `en_oils` 字段;update 端点写入 DB;SELECT / `_recipe_to_dict` 补上该字段 | | `frontend/src/stores/recipes.js` | store 映射 `en_oils` 字段 | | `frontend/src/components/RecipeDetailOverlay.vue` | 保存时同时提交 `en_oils`;加载时优先用已保存的译名,再 fallback 静态表 |
hera closed this issue 2026-04-09 18:41:19 +00:00
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hera/oil-formula-calculator#15