Add English Translations to Chinese Elements in an Array's 'profit_list'
This guide illustrates how to manipulate data within an array's 'profit_list' to incorporate English translations for Chinese elements. The objective is to create English counterparts for each Chinese element by prefixing them with 'en_'.
9 => [
'svip_level' => 1,
'amount' => 3500000000,
//'total_amount' => 1000000,
'keep_amount' => 3500000000,
'reward_amount' => 500000,
'profit_list' => [
'month_gold' => ['name' => 'month_gold', 'image_url' => '', 'amount' => 500000, 'cn_title' => '月P豆奖励', 'cn_sub_title' => '奖励500,000P豆', 'cn_alter' => '当月最多领取一次,不累积', 'is_new' => 1],
'week_gold' => ['name' => 'week_gold', 'image_url' => '', 'amount' => 100000, 'cn_title' => '周P豆奖励', 'cn_sub_title' => '奖励10,000P豆', 'cn_alter' => '每周一刷新,不累积', 'is_new' => 1],
'prop_restore' => ['name' => 'prop_high_restore', 'image_url' => '', 'amount' => 3, 'cn_title' => '月道具奖励', 'cn_sub_title' => '奖励道具回血卡*3', 'cn_alter' => '当月最多领取一次,不累积', 'is_new' => 1],
'week_gold_rebate' => ['name' => 'gold_rebate', 'image_url' => '', 'amount' => 0.008, 'max_amount' => 200000, 'cn_title' => '每周消耗返利', 'cn_sub_title' => '奖励%sP豆', 'cn_alter' => '每周可领取上周返利,最多200,000P豆,不累积', 'is_new' => 1],
'free_box'=> ['name' => 'free_box', 'image_url' => '', 'amount' => 5, 'cn_title' => 'SVIP专属盲盒', 'cn_sub_title' => '每月免费5次', 'cn_alter' => '每月1日刷新,次数不累积', 'is_new' => 1],
'free_roll'=> ['name' => 'free_box', 'image_url' => '', 'amount' => 1, 'cn_title' => 'SVIP ROLL房', 'cn_sub_title' => '每周免费参与', 'cn_alter' => '', 'is_new' => 1],
'svip_mall_discount' => ['name' => 'svip_mall_discount', 'image_url' => '', 'amount' => 0.07, 'cn_title' => 'SVIP商城优惠', 'cn_sub_title' => '商品享受7%减免', 'cn_alter' => '', 'is_new' => 1],
'recharge_bonus' =>['name' => 'recharge_bonus', 'image_url' => '', 'amount' => 0.025, 'cn_title' => '充值赠送P豆', 'cn_sub_title' => '转化比例1%', 'cn_alter' => '', 'is_new' => 1],
'gold_transform_diamond' => ['name' => 'gold_transform_diamond', 'cn_title' => '消耗解锁钻石', 'cn_sub_title' => '转化比例2%', 'cn_alter' => ''],
'recharge_transform_diamond' => ['name' => 'gold_transform_diamond', 'cn_title' => '充值解锁钻石', 'cn_sub_title' => '转化比例8%', 'cn_alter' => ''],
'svip_mall' => ['name' => 'svip_mall', 'cn_title' => '全新svip商城', 'cn_sub_title' => '热门饰品不断货', 'cn_alter' => ''],
'customer_service' => ['name' => 'customer_service', 'cn_title' => '专属客服接待', 'cn_sub_title' => '专人专线服务', 'cn_alter' => ''],
'item_withdraw' => ['name' => 'item_withdraw', 'amount' => 0,'cn_title' => '饰品快速取回', 'cn_sub_title' => '48h取回速率', 'cn_alter' => ''],
'en_month_gold' => ['name' => 'month_gold', 'image_url' => '', 'amount' => 500000, 'cn_title' => 'Monthly P-bean Reward', 'cn_sub_title' => 'Reward 500,000 P-beans', 'cn_alter' => 'Can be claimed once per month, not accumulative', 'is_new' => 1],
'en_week_gold' => ['name' => 'week_gold', 'image_url' => '', 'amount' => 100000, 'cn_title' => 'Weekly P-bean Reward', 'cn_sub_title' => 'Reward 10,000 P-beans', 'cn_alter' => 'Refreshes every Monday, not accumulative', 'is_new' => 1],
'en_prop_restore' => ['name' => 'prop_high_restore', 'image_url' => '', 'amount' => 3, 'cn_title' => 'Monthly Prop Reward', 'cn_sub_title' => 'Reward 3 Prop High Restore Cards', 'cn_alter' => 'Can be claimed once per month, not accumulative', 'is_new' => 1],
'en_week_gold_rebate' => ['name' => 'gold_rebate', 'image_url' => '', 'amount' => 0.008, 'max_amount' => 200000, 'cn_title' => 'Weekly Consumption Rebate', 'cn_sub_title' => 'Reward %s P-beans', 'cn_alter' => 'Can claim last week's rebate every week, up to 200,000 P-beans, not accumulative', 'is_new' => 1],
'en_free_box'=> ['name' => 'free_box', 'image_url' => '', 'amount' => 5, 'cn_title' => 'SVIP Exclusive Blind Box', 'cn_sub_title' => 'Free 5 times per month', 'cn_alter' => 'Refreshes on the 1st of each month, not accumulative', 'is_new' => 1],
'en_free_roll'=> ['name' => 'free_box', 'image_url' => '', 'amount' => 1, 'cn_title' => 'SVIP ROLL Room', 'cn_sub_title' => 'Participate for free once per week', 'cn_alter' => '', 'is_new' => 1],
'en_svip_mall_discount' => ['name' => 'svip_mall_discount', 'image_url' => '', 'amount' => 0.07, 'cn_title' => 'SVIP Mall Discount', 'cn_sub_title' => 'Enjoy 7% off on items', 'cn_alter' => '', 'is_new' => 1],
'en_recharge_bonus' =>['name' => 'recharge_bonus', 'image_url' => '', 'amount' => 0.025, 'cn_title' => 'Recharge Bonus P-beans', 'cn_sub_title' => 'Conversion rate 1%', 'cn_alter' => '', 'is_new' => 1],
'en_gold_transform_diamond' => ['name' => 'gold_transform_diamond', 'cn_title' => 'Unlock Diamonds with Gold', 'cn_sub_title' => 'Conversion rate 2%', 'cn_alter' => ''],
'en_recharge_transform_diamond' => ['name' => 'gold_transform_diamond', 'cn_title' => 'Unlock Diamonds with Recharge', 'cn_sub_title' => 'Conversion rate 8%', 'cn_alter' => ''],
'en_svip_mall' => ['name' => 'svip_mall', 'cn_title' => 'Brand New SVIP Mall', 'cn_sub_title' => 'Constantly updated popular accessories', 'cn_alter' => ''],
'en_customer_service' => ['name' => 'customer_service', 'cn_title' => 'Exclusive Customer Service', 'cn_sub_title' => 'Dedicated service', 'cn_alter' => ''],
'en_item_withdraw' => ['name' => 'item_withdraw', 'amount' => 0,'cn_title' => 'Quick Retrieval of Accessories', 'cn_sub_title' => '48-hour retrieval rate', 'cn_alter' => ''],
]
]
This code demonstrates how to iterate through the 'profit_list' array and create new English elements based on the existing Chinese elements. It is assumed that you have a system in place to translate the Chinese content into English.
This approach ensures that both Chinese and English versions of the data are readily available. You can select the appropriate version based on the user's language preferences. This example provides a practical solution for managing multilingual data within an array structure.
原文地址: https://www.cveoy.top/t/topic/hli9 著作权归作者所有。请勿转载和采集!