fix: 拖选文字时弹窗不再误关闭 #27
@@ -99,6 +99,7 @@ class RecipeIn(BaseModel):
|
||||
note: str = ""
|
||||
ingredients: list[IngredientIn]
|
||||
tags: list[str] = []
|
||||
en_name: Optional[str] = None
|
||||
|
||||
|
||||
class RecipeUpdate(BaseModel):
|
||||
|
||||
@@ -37,10 +37,58 @@ export function oilEn(name) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const RECIPE_KEYWORDS = {
|
||||
'头疗':'Scalp Therapy','头痛':'Headache','偏头痛':'Migraine','头皮':'Scalp','头发':'Hair',
|
||||
'肩颈':'Neck & Shoulder','颈椎':'Cervical','肩':'Shoulder','腰椎':'Lumbar','腰':'Lower Back',
|
||||
'关节':'Joint','膝':'Knee','背':'Back','胸':'Chest','腹部':'Abdominal',
|
||||
'乳腺':'Breast','子宫':'Uterine','私密':'Intimate','卵巢':'Ovarian',
|
||||
'淋巴':'Lymph','肝':'Liver','肾':'Kidney','脾':'Spleen','胃':'Stomach','肺':'Lung','肠':'Intestinal',
|
||||
'酸痛':'Pain Relief','疼痛':'Pain Relief','止痛':'Pain Relief',
|
||||
'感冒':'Cold','发烧':'Fever','咳嗽':'Cough','咽喉':'Throat',
|
||||
'过敏':'Allergy','鼻炎':'Rhinitis','哮喘':'Asthma',
|
||||
'湿疹':'Eczema','痘痘':'Acne','粉刺':'Acne',
|
||||
'消炎':'Anti-Inflammatory','便秘':'Constipation','消化':'Digestion',
|
||||
'失眠':'Insomnia','助眠':'Sleep Aid','好眠':'Sleep Well','安眠':'Sleep',
|
||||
'焦虑':'Anxiety','抑郁':'Depression','情绪':'Emotional',
|
||||
'压力':'Stress','放松':'Relaxation','舒缓':'Soothing',
|
||||
'水肿':'Edema','痛经':'Menstrual Pain','月经':'Menstrual','更年期':'Menopause','荷尔蒙':'Hormone',
|
||||
'结节':'Nodule','囊肿':'Cyst','灰指甲':'Nail Fungus','脚气':'Athlete\'s Foot',
|
||||
'白发':'Gray Hair','脱发':'Hair Loss','生发':'Hair Growth',
|
||||
'瘦身':'Slimming','紫外线':'UV','抗衰':'Anti-Aging','美白':'Whitening','补水':'Hydrating',
|
||||
'排毒':'Detox','净化':'Purifying','驱蚊':'Mosquito Repellent',
|
||||
'护理':'Care','调理':'Therapy','修复':'Repair','养护':'Nourish',
|
||||
'按摩':'Massage','刮痧':'Gua Sha','泡脚':'Foot Soak','精油浴':'Oil Bath',
|
||||
'喷雾':'Spray','扩香':'Diffuser',
|
||||
'疏通':'Unblock','祛湿':'Dampness Relief','驱寒':'Warming','健脾':'Spleen Wellness',
|
||||
'美容':'Beauty','面膜':'Face Mask','发膜':'Hair Mask',
|
||||
'配方':'Blend','方':'Blend','包':'Blend',
|
||||
'增强版':'Enhanced','高配版':'Premium','男士':'Men\'s','儿童':'Children\'s',
|
||||
'呼吸系统':'Respiratory System','呼吸':'Respiratory','免疫':'Immunity',
|
||||
'缓解':'Relief','改善':'Improve','预防':'Prevention',
|
||||
'带脉':'Belt Meridian','经络':'Meridian','静脉曲张':'Varicose Veins',
|
||||
'口腔溃疡':'Mouth Ulcer','口唇疱疹':'Cold Sore','蚊虫叮咬':'Insect Bite',
|
||||
'暖宫':'Uterus Warming','调经':'Menstrual Regulation',
|
||||
}
|
||||
const _SORTED = Object.keys(RECIPE_KEYWORDS).sort((a, b) => b.length - a.length)
|
||||
|
||||
export function recipeNameEn(name) {
|
||||
// Try to translate known keywords
|
||||
// Simple approach: return original name for now, user can customize
|
||||
return name
|
||||
if (!name) return name
|
||||
const parts = []
|
||||
let i = 0
|
||||
while (i < name.length) {
|
||||
let matched = false
|
||||
for (const key of _SORTED) {
|
||||
if (name.substring(i, i + key.length) === key) {
|
||||
const en = RECIPE_KEYWORDS[key]
|
||||
if (!parts.includes(en)) parts.push(en)
|
||||
i += key.length
|
||||
matched = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!matched) i++
|
||||
}
|
||||
return parts.length ? parts.join(' ') : name
|
||||
}
|
||||
|
||||
// Custom translations (can be set by admin)
|
||||
|
||||
Reference in New Issue
Block a user