| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- // 食材分类配置
- export interface IngredientCategory {
- id: string
- name: string
- icon: string
- color: string
- items: string[]
- }
- // 食材分类配置模板(不包含国际化文案)
- const ingredientCategoriesConfig = [
- {
- id: 'meat',
- icon: '🥩',
- color: 'bg-red-100 border-red-300 text-red-800',
- itemKeys: [
- 'pork', 'beef', 'lamb', 'chicken', 'duck', 'goose', 'rabbit', 'donkey',
- 'porkRibs', 'beefSteak', 'lambChops', 'chickenWings', 'chickenLegs', 'chickenBreast', 'chickenFeet', 'duckLegs',
- 'porkBelly', 'leanMeat', 'shreddedMeat', 'slicedMeat', 'dicedMeat', 'mincedMeat',
- 'tenderloin', 'porkShoulder', 'curedMeat', 'sausage', 'ham', 'bacon', 'chineseSausage',
- 'saltedMeat', 'airDriedMeat', 'beefJerky', 'porkTrotters', 'porkTripe', 'porkLiver',
- 'porkHeart', 'porkLung', 'porkKidney', 'beefTripe', 'lambTripe', 'chickenHeart',
- 'chickenLiver', 'chickenGizzard', 'duckBlood', 'pigBlood'
- ]
- },
- {
- id: 'seafood',
- icon: '🦀',
- color: 'bg-blue-100 border-blue-300 text-blue-800',
- itemKeys: [
- 'seaBass', 'crucianCarp', 'grassCarp', 'carp', 'hairtail', 'yellowCroaker', 'cod', 'salmon',
- 'tuna', 'pomfret', 'grouper', 'mandarinFish', 'silverCarp', 'blackCarp', 'wuchangFish', 'flounder',
- 'eel', 'swordfish', 'largeShrimp', 'kurumaShrimp', 'lobster', 'whiteShrimp', 'riverShrimp',
- 'prawn', 'pairedShrimp', 'mantisShrimp', 'crab', 'hairyCrab', 'swimmingCrab', 'greenCrab',
- 'hairyCrab2', 'scallop', 'clam', 'oyster', 'oyster2', 'clam2', 'clam3', 'conch', 'snail',
- 'squid', 'octopus', 'cuttlefish', 'seaCucumber', 'abalone', 'kelp', 'nori', 'wakame'
- ]
- },
- {
- id: 'vegetables',
- icon: '🥬',
- color: 'bg-green-100 border-green-300 text-green-800',
- itemKeys: [
- 'cabbage', 'chineseCabbage', 'babyCabbage', 'babyBokChoy', 'spinach', 'chineseChives', 'yellowChives',
- 'celery', 'westernCelery', 'lettuce', 'rapeseed', 'babyRapeseed', 'babyChoySum', 'mustardGreens',
- 'waterSpinach', 'amaranth', 'crownDaisy', 'tomato', 'cherryTomato', 'cucumber', 'babyCucumber',
- 'eggplant', 'longEggplant', 'roundEggplant', 'greenBeans', 'snapBeans', 'hyacinthBeans', 'cowpeas',
- 'snowPeas', 'peas', 'edamame', 'greenPepper', 'redPepper', 'yellowPepper', 'bellPepper',
- 'hotPepper', 'heavenFacingPepper', 'birdsEyeChili', 'pickledPepper', 'potato', 'sweetPotato',
- 'purpleSweetPotato', 'chineseYam', 'taro', 'lotusRoot', 'waterChestnut', 'arrowhead', 'radish',
- 'whiteRadish', 'carrot', 'greenRadish', 'redRadish', 'cherryRadish', 'onion', 'scallion',
- 'greenOnion', 'chive', 'garlicSprouts', 'yellowGarlicSprouts', 'garlic', 'ginger', 'winterMelon',
- 'pumpkin', 'luffa', 'bitterMelon', 'cucumber2', 'zucchini', 'buddhasHand', 'snakeGourd',
- 'beanSprouts', 'mungBeanSprouts', 'soybeanSprouts', 'peaShoots', 'radishSprouts', 'chineseToon',
- 'bracken', 'purslane', 'cauliflower', 'broccoli', 'cabbage2', 'purpleCabbage', 'chineseBroccoli', 'cauliflower2'
- ]
- },
- {
- id: 'mushrooms',
- icon: '🍄',
- color: 'bg-yellow-100 border-yellow-300 text-yellow-800',
- itemKeys: [
- 'shiitake', 'flowerMushroom', 'oysterMushroom', 'enokiMushroom', 'kingOysterMushroom', 'teaTreeMushroom',
- 'strawMushroom', 'buttonMushroom', 'crabMushroom', 'whiteJadeMushroom', 'seafoodMushroom', 'chickenLegMushroom',
- 'slipperyMushroom', 'xiuZhenMushroom', 'woodEar', 'blackWoodEar', 'silverEar', 'snowEar', 'hairyWoodEar',
- 'bambooFungus', 'lionsMane', 'matsutake', 'porcini', 'morel', 'chanterelle', 'hazelMushroom', 'yuanMushroom'
- ]
- },
- {
- id: 'beans',
- icon: '🫘',
- color: 'bg-orange-100 border-orange-300 text-orange-800',
- itemKeys: [
- 'tofu', 'softTofu', 'firmTofu', 'silkenTofu', 'driedTofu', 'fragrantTofu', 'whiteDriedTofu', 'tofuSkin',
- 'driedTofuSkin', 'thousandSheets', 'tofuPuffs', 'friedTofu', 'frozenTofu', 'stinkyTofu', 'edamame2',
- 'peas2', 'broadBeans', 'mungBeans', 'redBeans', 'blackBeans', 'soybeans', 'kidneyBeans', 'beanSprouts2',
- 'peaShoots2', 'greenBeans2', 'snapBeans2', 'hyacinthBeans2', 'cowpeas2', 'snowPeas2', 'fermentedTofu',
- 'blackBeanSauce', 'natto', 'soyMilk', 'tofuPudding'
- ]
- },
- {
- id: 'eggs',
- icon: '🥚',
- color: 'bg-amber-100 border-amber-300 text-amber-800',
- itemKeys: [
- 'egg', 'freeRangeEgg', 'duckEgg', 'gooseEgg', 'quailEgg', 'pigeonEgg', 'saltedDuckEgg',
- 'preservedEgg', 'centuryEgg', 'teaEgg', 'marinatedEgg', 'softBoiledEgg'
- ]
- },
- {
- id: 'fruits',
- icon: '🍎',
- color: 'bg-pink-100 border-pink-300 text-pink-800',
- itemKeys: [
- 'apple', 'pear', 'peach', 'plum', 'apricot', 'cherry', 'grape', 'strawberry', 'blueberry',
- 'banana', 'orange', 'pomelo', 'lemon', 'tangerine', 'mandarin', 'kumquat', 'citrus',
- 'watermelon', 'hamiMelon', 'melon', 'muskmelon', 'papaya', 'mango', 'pineapple', 'kiwi',
- 'dragonFruit', 'passionFruit', 'lychee', 'longan', 'jujube', 'persimmon', 'pomegranate', 'hawthorn'
- ]
- },
- {
- id: 'nuts',
- icon: '🥜',
- color: 'bg-amber-100 border-amber-300 text-amber-800',
- itemKeys: [
- 'peanut', 'walnut', 'almond', 'cashew', 'pistachio', 'pineNut', 'hazelnut', 'chestnut',
- 'sunflowerSeeds', 'sunflowerSeeds2', 'pumpkinSeeds', 'watermelonSeeds', 'sesame', 'blackSesame', 'whiteSesame'
- ]
- },
- {
- id: 'dairy',
- icon: '🥛',
- color: 'bg-blue-50 border-blue-200 text-blue-700',
- itemKeys: [
- 'milk', 'yogurt', 'cheese', 'cheese2', 'cream', 'butter', 'condensedMilk', 'milkPowder',
- 'mozzarella', 'cheddar', 'parmesan', 'milkshake'
- ]
- }
- ] as const
- // 获取国际化后的食材分类配置
- export function getIngredientCategories(t: (key: string) => string): IngredientCategory[] {
- return ingredientCategoriesConfig.map(category => ({
- id: category.id,
- name: t(`ingredients.categories.${category.id}`),
- icon: category.icon,
- color: category.color,
- items: category.itemKeys.map((_, index) => {
- // 使用索引来获取翻译,因为翻译文件是按数组顺序排列的
- return t(`ingredients.items.${category.id}.${index}`)
- })
- }))
- }
- // 为了向后兼容,导出一个默认的配置(使用中文)
- // 注意:这个导出在组件中应该使用 getIngredientCategories 来替代
- // export const ingredientCategories: IngredientCategory[] = getIngredientCategories((key: string) => {
- // // 默认返回中文翻译
- // const translations: Record<string, string> = {
- // 'ingredients.categories.meat': '荤菜',
- // 'ingredients.categories.seafood': '海鲜',
- // 'ingredients.categories.vegetables': '蔬菜',
- // 'ingredients.categories.mushrooms': '菌菇',
- // 'ingredients.categories.beans': '豆类',
- // 'ingredients.categories.eggs': '蛋类',
- // 'ingredients.categories.fruits': '水果',
- // 'ingredients.categories.nuts': '坚果',
- // 'ingredients.categories.dairy': '奶制品',
- // }
-
- // // 如果包含索引,说明是食材项
- // const match = key.match(/ingredients\.items\.(\w+)\.(\d+)/)
- // if (match) {
- // const [, categoryId, index] = match
- // const defaultItems: Record<string, string[]> = {
- // meat: ['猪肉', '牛肉', '羊肉', '鸡肉', '鸭肉', '鹅肉', '兔肉', '驴肉', '猪排骨', '牛排', '羊排', '鸡翅', '鸡腿', '鸡胸肉', '鸡爪', '鸭腿', '五花肉', '瘦肉', '肉丝', '肉片', '肉丁', '肉馅', '里脊肉', '梅花肉', '腊肉', '香肠', '火腿', '培根', '腊肠', '咸肉', '风干肉', '牛肉干', '猪蹄', '猪肚', '猪肝', '猪心', '猪肺', '猪腰', '牛肚', '羊肚', '鸡心', '鸡肝', '鸡胗', '鸭血', '猪血'],
- // seafood: ['鲈鱼', '鲫鱼', '草鱼', '鲤鱼', '带鱼', '黄鱼', '鳕鱼', '三文鱼', '金枪鱼', '鲳鱼', '石斑鱼', '桂鱼', '鲢鱼', '青鱼', '武昌鱼', '比目鱼', '鳗鱼', '刀鱼', '大虾', '基围虾', '龙虾', '白虾', '河虾', '明虾', '对虾', '皮皮虾', '螃蟹', '大闸蟹', '梭子蟹', '青蟹', '毛蟹', '扇贝', '蛤蜊', '生蚝', '牡蛎', '花甲', '蚬子', '海螺', '田螺', '鱿鱼', '章鱼', '墨鱼', '海参', '鲍鱼', '海带', '紫菜', '裙带菜'],
- // vegetables: ['白菜', '大白菜', '小白菜', '娃娃菜', '菠菜', '韭菜', '韭黄', '芹菜', '西芹', '生菜', '油菜', '小油菜', '菜心', '芥菜', '空心菜', '苋菜', '茼蒿', '西红柿', '樱桃番茄', '黄瓜', '小黄瓜', '茄子', '长茄子', '圆茄子', '豆角', '四季豆', '扁豆', '豇豆', '荷兰豆', '豌豆', '毛豆', '青椒', '红椒', '黄椒', '彩椒', '尖椒', '朝天椒', '小米椒', '泡椒', '土豆', '红薯', '紫薯', '山药', '芋头', '莲藕', '荸荠', '慈姑', '萝卜', '白萝卜', '胡萝卜', '青萝卜', '心里美萝卜', '樱桃萝卜', '洋葱', '大葱', '小葱', '香葱', '蒜苗', '蒜黄', '大蒜', '生姜', '冬瓜', '南瓜', '丝瓜', '苦瓜', '黄瓜', '西葫芦', '佛手瓜', '蛇瓜', '豆芽', '绿豆芽', '黄豆芽', '豆苗', '萝卜苗', '香椿', '蕨菜', '马齿苋', '菜花', '西兰花', '包菜', '紫甘蓝', '芥蓝', '花椰菜'],
- // mushrooms: ['香菇', '花菇', '平菇', '金针菇', '杏鲍菇', '茶树菇', '草菇', '口蘑', '蟹味菇', '白玉菇', '海鲜菇', '鸡腿菇', '滑子菇', '秀珍菇', '木耳', '黑木耳', '银耳', '雪耳', '毛木耳', '竹荪', '猴头菇', '松茸', '牛肝菌', '羊肚菌', '鸡油菌', '榛蘑', '元蘑'],
- // beans: ['豆腐', '嫩豆腐', '老豆腐', '内酯豆腐', '豆腐干', '香干', '白干', '豆皮', '腐竹', '千张', '豆泡', '油豆腐', '冻豆腐', '臭豆腐', '毛豆', '豌豆', '蚕豆', '绿豆', '红豆', '黑豆', '黄豆', '芸豆', '豆芽', '豆苗', '豆角', '四季豆', '扁豆', '豇豆', '荷兰豆', '腐乳', '豆豉', '纳豆', '豆浆', '豆花'],
- // eggs: ['鸡蛋', '土鸡蛋', '鸭蛋', '鹅蛋', '鹌鹑蛋', '鸽子蛋', '咸鸭蛋', '松花蛋', '皮蛋', '茶叶蛋', '卤蛋', '溏心蛋'],
- // fruits: ['苹果', '梨', '桃子', '李子', '杏', '樱桃', '葡萄', '草莓', '蓝莓', '香蕉', '橙子', '柚子', '柠檬', '橘子', '桔子', '金桔', '柑橘', '西瓜', '哈密瓜', '甜瓜', '香瓜', '木瓜', '芒果', '菠萝', '猕猴桃', '火龙果', '百香果', '荔枝', '龙眼', '枣', '柿子', '石榴', '山楂'],
- // nuts: ['花生', '核桃', '杏仁', '腰果', '开心果', '松子', '榛子', '板栗', '瓜子', '葵花籽', '南瓜子', '西瓜子', '芝麻', '黑芝麻', '白芝麻'],
- // dairy: ['牛奶', '酸奶', '奶酪', '芝士', '奶油', '黄油', '炼乳', '奶粉', '马苏里拉奶酪', '车达奶酪', '帕玛森奶酪', '奶昔']
- // }
- // return defaultItems[categoryId]?.[parseInt(index)] || ''
- // }
-
- // return translations[key] || key
- // })
|