Explorar o código

fix: 国际化处理

liangan hai 3 semanas
pai
achega
79599281a5

+ 2 - 1
src/App.vue

@@ -1,6 +1,7 @@
 <script setup>
 import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
 import { usePageAuth } from '@/hooks/usePageAuth'
+import { t } from '@/locale'
 import { useUserStore } from '@/store'
 import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
 
@@ -21,7 +22,7 @@ onLaunch(() => {
       if (status < 2) {
         uni.showToast({
           icon: 'none',
-          title: '您还没有打开通知权限',
+          title: t('app.notificationPermission'),
           duration: 3000,
         })
       }

+ 34 - 2
src/locale/bn.json

@@ -101,7 +101,7 @@
   "home.refer&earn": "রেফার\nএবং আয়",
   "home.vip": "ভিআইপি\nসদস্যতা",
   "home.bestSellers": "সেরা\nবিক্রেতা",
-  "home.topChampions": "শীর্ষ\nচ্যাম্পিয়ন",
+  "home.topChampions": "শীর্ষ চ্যাম্পিয়ন",
   "home.news": "নতুন",
   "home.priceTab.allPrice": "All Price",
   "home.priceTab.300spot": "৩০০স্পট",
@@ -375,5 +375,37 @@
   "topChampions.teamMembers": "টিম সদস্যরা",
   "topChampions.joinedGroups": "যোগদানকৃত গ্রুপ",
   "wallet.recharge.title": "রিচার্জ",
-  "wallet.recharge.submit": "জমা দিন"
+  "wallet.recharge.submit": "জমা দিন",
+  "orderDetail.deliveryPartner": "ডেলিভারি পার্টনার",
+  "orderDetail.subTotal": "উপমোট",
+  "orderDetail.bandhuBuyWallet": "BandhuBuy ওয়ালেট",
+  "orderDetail.paymentMethod": "পেমেন্ট পদ্ধতি",
+  "orderDetail.walletBalanceText": "ওয়ালেট ব্যালেন্স",
+  "productDetail.fullRefundText": "অসফল গ্রুপ ক্রয়ের জন্য সম্পূর্ণ ফেরত",
+  "productDetail.redEnvelopeRewards": "লাল খাম পুরস্কার পান",
+  "app.notificationPermission": "আপনি এখনও বিজ্ঞপ্তি অনুমতি খুলেন নি",
+  "wallet.recharge.record": "রেকর্ড",
+  "wallet.recharge.selectProvider": "আপনার ওয়ালেট প্রভাইডার নির্বাচন করুন",
+  "wallet.recharge.depositAmount": "জমার পরিমাণ",
+  "wallet.recharge.reminder": "স্মরণ: রিচার্জ সফল না হলে, অন্য চ্যানেল নির্বাচন করুন। লেনদেন আইডি সঠিকভাবে পূরণ করতে হবে।",
+  "wallet.recharge.enterAmount": "রিচার্জ পরিমাণ লিখুন",
+  "wallet.recharge.minAmount": "সর্বনিম্ন রিচার্জ পরিমাণ {minAmount}",
+  "wallet.recharge.maxAmount": "সর্বোচ্চ রিচার্জ পরিমাণ {maxAmount}",
+  "orderDetail.rechargeDialog.title": "আপনার ওয়ালেট ব্যালেন্স অপর্যাপ্ত।\\nদয়া করে রিচার্জ করুন!",
+  "orderDetail.rechargeDialog.confirm": "এখন রিচার্জ করুন",
+  "orderDetail.payDialog.title": "পেমেন্ট",
+  "orderDetail.payDialog.confirm": "এখন পরিশোধ করুন",
+  "orderDetail.time.placed": "অর্ডার করা হয়েছে",
+  "orderDetail.time.paid": "পরিশোধিত",
+  "orderDetail.time.shipped": "পাঠানো হয়েছে",
+  "orderDetail.time.completed": "সম্পন্ন হয়েছে",
+  "orderDetail.copy.success": "ক্লিপবোর্ডে অনুলিপি করা হয়েছে",
+  "wallet.unpaidOrderDialog.title": "আপনার কাছে অসম্পন্ন টপ-আপ অর্ডার রয়েছে,\\nআপনি কি চালিয়ে যেতে চান?",
+  "wallet.unpaidOrderDialog.confirm": "দেখুন",
+  "wallet.unpaidOrderDialog.cancel": "বাতিল করুন",
+  "wallet.record.type.DT": "DT",
+  "wallet.record.type.YT": "YT",
+  "wallet.record.type.L7D": "L7D",
+  "wallet.record.type.MTD": "MTD",
+  "wallet.record.type.YTD": "YTD"
 }

+ 33 - 1
src/locale/en.json

@@ -376,5 +376,37 @@
   "topChampions.teamMembers": "Team Members",
   "topChampions.joinedGroups": "Joined Groups",
   "wallet.recharge.title": "Recharge",
-  "wallet.recharge.submit": "Submit"
+  "wallet.recharge.submit": "Submit",
+  "orderDetail.deliveryPartner": "Delivery Partner",
+  "orderDetail.subTotal": "SubTotal",
+  "orderDetail.bandhuBuyWallet": "BandhuBuy Wallet",
+  "orderDetail.paymentMethod": "Payment Method",
+  "orderDetail.walletBalanceText": "Wallet Balance",
+  "productDetail.fullRefundText": "Full refund for unsuccessful group purchase",
+  "productDetail.redEnvelopeRewards": "Receive red envelope rewards",
+  "app.notificationPermission": "You have not opened notification permissions",
+  "wallet.recharge.record": "Record",
+  "wallet.recharge.selectProvider": "Select Your Wallet Provider",
+  "wallet.recharge.depositAmount": "Deposit Amount",
+  "wallet.recharge.reminder": "Reminder: If the recharge is not successful, please select another channel. Transaction ID must be filled in correctly.",
+  "wallet.recharge.enterAmount": "Please enter recharge amount",
+  "wallet.recharge.minAmount": "Minimum recharge amount is {minAmount}",
+  "wallet.recharge.maxAmount": "Maximum recharge amount is {maxAmount}",
+  "orderDetail.rechargeDialog.title": "Your wallet balance is insufficient.\\nPlease Recharge!",
+  "orderDetail.rechargeDialog.confirm": "Recharge Now",
+  "orderDetail.payDialog.title": "Payment",
+  "orderDetail.payDialog.confirm": "Pay Now",
+  "orderDetail.time.placed": "Placed On",
+  "orderDetail.time.paid": "Paid On",
+  "orderDetail.time.shipped": "Shipped On",
+  "orderDetail.time.completed": "Completed On",
+  "orderDetail.copy.success": "Copied to clipboard",
+  "wallet.unpaidOrderDialog.title": "You have unfinished top up orders,\\nDo you want to continue?",
+  "wallet.unpaidOrderDialog.confirm": "View",
+  "wallet.unpaidOrderDialog.cancel": "Cancel",
+  "wallet.record.type.DT": "DT",
+  "wallet.record.type.YT": "YT",
+  "wallet.record.type.L7D": "L7D",
+  "wallet.record.type.MTD": "MTD",
+  "wallet.record.type.YTD": "YTD"
 }

+ 33 - 1
src/locale/zh-Hans.json

@@ -375,5 +375,37 @@
   "topChampions.teamMembers": "团队成员",
   "topChampions.joinedGroups": "加入群组",
   "wallet.recharge.title": "充值",
-  "wallet.recharge.submit": "提交"
+  "wallet.recharge.submit": "提交",
+  "orderDetail.deliveryPartner": "物流伙伴",
+  "orderDetail.subTotal": "小计",
+  "orderDetail.bandhuBuyWallet": "BandhuBuy 钱包",
+  "orderDetail.paymentMethod": "支付方式",
+  "orderDetail.walletBalanceText": "钱包余额",
+  "productDetail.fullRefundText": "拼团不成功全额退款",
+  "productDetail.redEnvelopeRewards": "获得红包奖励",
+  "app.notificationPermission": "您还没有打开通知权限",
+  "wallet.recharge.record": "记录",
+  "wallet.recharge.selectProvider": "选择您的钱包提供商",
+  "wallet.recharge.depositAmount": "存款金额",
+  "wallet.recharge.reminder": "提醒:如果充值不成功,请选择其他渠道。交易ID必须正确填写。",
+  "wallet.recharge.enterAmount": "请输入充值金额",
+  "wallet.recharge.minAmount": "最小充值金额为 {minAmount}",
+  "wallet.recharge.maxAmount": "最大充值金额为 {maxAmount}",
+  "orderDetail.rechargeDialog.title": "您的钱包余额不足。\\n请充值!",
+  "orderDetail.rechargeDialog.confirm": "立即充值",
+  "orderDetail.payDialog.title": "支付",
+  "orderDetail.payDialog.confirm": "立即支付",
+  "orderDetail.time.placed": "下单时间",
+  "orderDetail.time.paid": "支付时间",
+  "orderDetail.time.shipped": "发货时间",
+  "orderDetail.time.completed": "完成时间",
+  "orderDetail.copy.success": "已复制到剪贴板",
+  "wallet.unpaidOrderDialog.title": "您有未完成的充值订单,\\n是否继续?",
+  "wallet.unpaidOrderDialog.confirm": "查看",
+  "wallet.unpaidOrderDialog.cancel": "取消",
+  "wallet.record.type.DT": "今天",
+  "wallet.record.type.YT": "昨天",
+  "wallet.record.type.L7D": "近7天",
+  "wallet.record.type.MTD": "本月",
+  "wallet.record.type.YTD": "本年"
 }

+ 1 - 1
src/pages/forgotPassword/forgotPassword.vue

@@ -137,7 +137,7 @@ async function handleResetPassword() {
   }
   catch (error) {
     uni.hideLoading()
-    toast.error(error.message || 'Failed to reset password')
+    toast.error(error.message || t('auth.forgotPassword.error.resetFailed'))
   }
 }
 

+ 16 - 16
src/pages/myOrders/orderDetail.vue

@@ -222,10 +222,10 @@ function handleDialogClose() {
 function showRechargeDialog() {
   dialogType.value = 'recharge'
   Object.assign(dialogConfig.value, DialogUtils.info(
-    `Your wallet balance is insufficient. \n Please Recharge!`,
+    t('orderDetail.rechargeDialog.title'),
     {
       showCancel: false,
-      confirmText: 'Recharge Now',
+      confirmText: t('orderDetail.rechargeDialog.confirm'),
       cancelText: '',
       confirmPlain: true,
     },
@@ -235,11 +235,11 @@ function showRechargeDialog() {
 function showPayOrderDialog() {
   dialogType.value = 'pay'
   Object.assign(dialogConfig.value, DialogUtils.info(
-    'Payment',
+    t('orderDetail.payDialog.title'),
     {
       showCancel: false,
       cancelText: '',
-      confirmText: 'Pay Now',
+      confirmText: t('orderDetail.payDialog.confirm'),
       confirmPlain: false,
     },
   ))
@@ -266,17 +266,17 @@ function handleClick() {
   }
 }
 const timeMap = {
-  create_order: 'Placed On',
-  pay_success: 'Paid On',
-  delivery: 'Shipped On',
-  receive: 'Completed On',
+  create_order: t('orderDetail.time.placed'),
+  pay_success: t('orderDetail.time.paid'),
+  delivery: t('orderDetail.time.shipped'),
+  receive: t('orderDetail.time.completed'),
 }
 
 function copyDelivery() {
   uni.setClipboardData({
     data: `${detail.value.deliveryName}: ${detail.value.deliveryId}`,
     success: () => {
-      toast.success('Copied to clipboard')
+      toast.success(t('orderDetail.copy.success'))
     },
   })
 }
@@ -459,7 +459,7 @@ onUnmounted(() => {
           <template v-else>
             <view v-if="detail.deliveryId" class="mb-18rpx flex justify-between border-b-1 border-b-#e8e8e8 border-b-solid pb-18rpx text-24rpx">
               <!-- 物流信息 -->
-              <view>Delivery Partner</view>
+              <view>{{ $t('orderDetail.deliveryPartner') }}</view>
               <view class="flex items-center gap-8rpx" @click="copyDelivery">
                 <text>{{ detail.deliveryName }}: {{ detail.deliveryId || '-' }}</text>
                 <wd-icon name="file-copy" size="28rpx" />
@@ -520,7 +520,7 @@ onUnmounted(() => {
             </view>
             <view class="flex flex-col gap-16rpx text-#3A444C">
               <view class="flex items-center justify-between text-24rpx">
-                <text>SubTotal</text>
+                <text>{{ $t('orderDetail.subTotal') }}</text>
                 <text>৳{{ formatNumber(detail.totalPrice) }}</text>
               </view>
             </view>
@@ -531,7 +531,7 @@ onUnmounted(() => {
             </view>
             <view class="flex flex-col gap-16rpx text-#3A444C">
               <view class="flex items-center justify-between text-24rpx">
-                <text>BandhuBuy Wallet</text>
+                <text>{{ $t('orderDetail.bandhuBuyWallet') }}</text>
               </view>
             </view>
           </view>
@@ -575,7 +575,7 @@ onUnmounted(() => {
     >
       <view v-if="dialogType === 'pay'">
         <view class="font-blod relative text-32rpx">
-          <text>BandhuBuy Wallet Pay</text>
+          <text>{{ $t('orderDetail.bandhuBuyWallet') }} {{ $t('orderDetail.paymentMethod') }}</text>
           <wd-icon name="close-normal" custom-class="absolute right-0 top-1/2 -translate-y-1/2" size="40rpx" @click="handleDialogClose" />
         </view>
         <view class="py-60rpx">
@@ -588,15 +588,15 @@ onUnmounted(() => {
         </view>
         <view class="pb-28rpx text-left">
           <view class="text-24rpx font-bold">
-            Payment Method
+            {{ $t('orderDetail.paymentMethod') }}
           </view>
           <view class="my-14rpx border-b-1px border-b-#EBEBEB border-b-solid" />
           <view class="flex items-center justify-between text-24rpx">
             <view class="flex items-center">
               <view class="text-24rpx">
-                <text>BandhuBuy Wallet (</text>
+                <text>{{ $t('orderDetail.bandhuBuyWallet') }} (</text>
                 <text class="text-[var(--wot-color-theme)]">
-                  Balance: ৳{{ formatNumber(balance) }}
+                  {{ $t('orderDetail.walletBalanceText') }}: ৳{{ formatNumber(balance) }}
                 </text>
                 <text>)</text>
               </view>

+ 2 - 2
src/pages/productDetail/checkOut.vue

@@ -128,9 +128,9 @@ async function handlePlaceOrder() {
                 class="mr-32rpx h-68rpx w-68rpx rounded-full"
               />
               <view class="text-24rpx">
-                <text>BandhuBuy Wallet(</text>
+                <text>{{ $t('orderDetail.bandhuBuyWallet') }}(</text>
                 <text class="text-[var(--wot-color-theme)]">
-                  {{ $t('checkout.walletBalance') }}: ৳ {{ formatNumber(walletBalance) }}
+                  {{ $t('orderDetail.walletBalanceText') }}: ৳ {{ formatNumber(walletBalance) }}
                 </text>
                 <text>)</text>
               </view>

+ 2 - 2
src/pages/productDetail/components/CustomTooltip.vue

@@ -115,11 +115,11 @@ defineExpose({
         class="mr-12rpx h-35rpx w-32rpx flex-shrink-0"
       />
       <view class="text-center">
-        <text>Full refund for unsuccessful group purchase </text>
+        <text>{{ $t('productDetail.fullRefundText') }} </text>
         <text class="text-[var(--wot-color-theme)]">
           {{ highlightText1 }}
         </text>
-        <text> Receive red envelope rewards </text>
+        <text> {{ $t('productDetail.redEnvelopeRewards') }} </text>
         <text class="text-[var(--wot-color-theme)]">
           {{ highlightText2 }}
         </text>

+ 9 - 8
src/pages/wallet/myWallet.vue

@@ -17,6 +17,7 @@ import { getEnum as _getEnum } from '@/api/common'
 import { getWalletAccountInfo, unpaidOrder, walletFlowList } from '@/api/wallet'
 import DialogBox from '@/components/DialogBox/DialogBox.vue'
 import { DialogUtils } from '@/components/DialogBox/utils'
+import { t } from '@/locale'
 import { formatNumber } from '@/utils'
 import { toPage } from '@/utils/page'
 // z-paging
@@ -55,11 +56,11 @@ async function getWalletFlowList(pageNo: number, pageSize: number) {
 // 显示取消订单确认对话框
 function showUnpaidOrderDialog() {
   Object.assign(dialogConfig.value, DialogUtils.info(
-    `You have unfinished top up orders,\nDo you want to continue?`,
+    t('wallet.unpaidOrderDialog.title'),
     {
       showCancel: true,
-      confirmText: 'Cancel',
-      cancelText: 'View',
+      confirmText: t('wallet.unpaidOrderDialog.confirm'),
+      cancelText: t('wallet.unpaidOrderDialog.cancel'),
     },
   ))
 }
@@ -150,19 +151,19 @@ onShow(() => {
         <view class="mb-20rpx">
           <wd-radio-group v-model="dayType" shape="button" @change="() => getWalletFlowList(1, 20)">
             <wd-radio :value="1">
-              DT
+              {{ $t('wallet.record.type.DT') }}
             </wd-radio>
             <wd-radio :value="2">
-              YT
+              {{ $t('wallet.record.type.YT') }}
             </wd-radio>
             <wd-radio :value="3">
-              L7D
+              {{ $t('wallet.record.type.L7D') }}
             </wd-radio>
             <wd-radio :value="4">
-              MTD
+              {{ $t('wallet.record.type.MTD') }}
             </wd-radio>
             <wd-radio :value="5">
-              YTD
+              {{ $t('wallet.record.type.YTD') }}
             </wd-radio>
           </wd-radio-group>
         </view>

+ 12 - 11
src/pages/wallet/recharge.vue

@@ -8,7 +8,7 @@
       "titleNView": {
         "buttons": [
           {
-            "text": "Record",
+            "text": "%wallet.recharge.record%",
             "fontSize": "28rpx",
             "width": "85px"
           }
@@ -21,6 +21,7 @@
 
 <script lang="ts" setup>
 import { paymentMethod, rechargeAdd, rechargeGoodsList } from '@/api/wallet'
+import { t } from '@/locale'
 import { formatNumber } from '@/utils'
 import { getPageParams, toPage } from '@/utils/page'
 import { toast } from '@/utils/toast'
@@ -44,7 +45,7 @@ const methodIconMap = {
 }
 // 触发确定按钮
 onNavigationBarButtonTap((event: any) => {
-  if (event.text === 'Record') {
+  if (event.text === t('wallet.recharge.record')) {
     toPage('/pages/wallet/rechargeRecord')
   }
 })
@@ -89,15 +90,15 @@ const loading = ref<boolean>(false)
 async function submit() {
   const amount = Number(selectData.value.customAmount || selectData.value.amount)
   if (!amount) {
-    toast.info('请输入充值金额')
+    toast.info(t('wallet.recharge.enterAmount'))
     return
   }
   if (amount < interval.value.miniPrice) {
-    toast.info(`最小充值金额为 ${interval.value.miniPrice}`)
+    toast.info(t('wallet.recharge.minAmount', { minAmount: interval.value.miniPrice }))
     return
   }
   if (amount > interval.value.maxPrice) {
-    toast.info(`最大充值金额为 ${interval.value.maxPrice}`)
+    toast.info(t('wallet.recharge.maxAmount', { maxAmount: interval.value.maxPrice }))
     return
   }
 
@@ -105,7 +106,7 @@ async function submit() {
   try {
     const addRes = await rechargeAdd({ amount, methodId: selectData.value.methodId })
     if (addRes.code === '200') {
-      toPage('/pages/webLink/webLink', { link: addRes.data.payUrl, title: 'Recharge' }, true)
+      toPage('/pages/webLink/webLink', { link: addRes.data.payUrl, title: t('wallet.recharge.title') }, true)
     }
   }
   finally {
@@ -136,7 +137,7 @@ watch(() => selectData.value.customAmount, (newVal) => {
   const amount = Number(numericValue)
   if (amount > interval.value.maxPrice) {
     selectData.value.customAmount = interval.value.maxPrice.toString()
-    toast.info(`最大充值金额为 ${interval.value.maxPrice}`)
+    toast.info(t('wallet.recharge.maxAmount', { maxAmount: interval.value.maxPrice }))
   }
 })
 </script>
@@ -145,7 +146,7 @@ watch(() => selectData.value.customAmount, (newVal) => {
   <z-paging>
     <view class="px-24rpx pt-36rpx">
       <view class="mb-24rpx text-24rpx font-bold">
-        Select Your Wallet Provider
+        {{ $t('wallet.recharge.selectProvider') }}
       </view>
       <view class="grid grid-cols-3 mb-30rpx gap-20rpx">
         <view
@@ -166,7 +167,7 @@ watch(() => selectData.value.customAmount, (newVal) => {
         </view>
       </view>
       <view class="mb-24rpx text-24rpx font-bold">
-        Deposit Amount
+        {{ $t('wallet.recharge.depositAmount') }}
       </view>
       <view class="grid grid-cols-3 mb-20rpx gap-20rpx">
         <view
@@ -192,7 +193,7 @@ watch(() => selectData.value.customAmount, (newVal) => {
       <wd-input
         v-model="selectData.customAmount"
         no-border
-        :placeholder="`৳ Min ${formatNumber(interval.miniPrice)} ~ ৳ ${formatNumber(interval.maxPrice)}`"
+        :placeholder="`${t('wallet.recharge.minAmount', { minAmount: formatNumber(interval.miniPrice) })} ~ ${t('wallet.recharge.maxAmount', { maxAmount: formatNumber(interval.maxPrice) })}`"
         custom-class="bandhu-auth-input-field"
         @focus="focusAmount"
       />
@@ -200,7 +201,7 @@ watch(() => selectData.value.customAmount, (newVal) => {
 
     <template #bottom>
       <view class="mb-20rpx px-24rpx text-24rpx text-#5A5A5A">
-        Reminder: If the recharge is not successful, please select another channel. Transaction ID must be filled in correctly.
+        {{ $t('wallet.recharge.reminder') }}
       </view>
       <view class="bg-white/60 px-28rpx py-30rpx backdrop-blur-20">
         <wd-button block :disabled="!selectData.amount && !selectData.customAmount" :loading="loading" @click="submit">

+ 3 - 2
src/pages/wallet/rechargeRecord.vue

@@ -15,6 +15,7 @@ import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
 import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
 import { getEnum as _getEnum } from '@/api/common'
 import { rechargeRecordList, thirdPayAgree } from '@/api/wallet'
+import { t } from '@/locale'
 import { formatNumber } from '@/utils'
 import { toPage } from '@/utils/page'
 
@@ -52,7 +53,7 @@ async function handleClick(data: any) {
       const res = await thirdPayAgree(data.id)
       console.log(res)
       if (res.code === '200') {
-        toPage('/pages/webLink/webLink', { link: res.data, title: 'Recharge' })
+        toPage('/pages/webLink/webLink', { link: res.data, title: t('wallet.recharge.title') })
       }
     }
     catch {}
@@ -73,7 +74,7 @@ onLoad(() => {
             <wd-text :type="item.status === 2 ? 'success' : 'primary'" bold :text="statusEnum.find(i => i.code === item.status)?.name" />
           </view>
           <view class="flex items-center justify-between text-22rpx text-#3A444C">
-            <view>Wallet Balance:+{{ formatNumber(item.amount) }}</view>
+            <view>{{ $t('orderDetail.walletBalanceText') }}:+{{ formatNumber(item.amount) }}</view>
             <view>{{ item.createTime }}</view>
           </view>
         </view>

+ 1 - 1
src/pages/wallet/withdrawRecord.vue

@@ -62,7 +62,7 @@ onLoad((options) => {
           <wd-text :type="item.status === 4 ? 'success' : 'primary'" bold :text="statusEnum.find(i => i.code === item.status)?.name" />
         </view>
         <view class="flex items-center justify-between text-22rpx text-#3A444C">
-          <view>Wallet Balance:-{{ formatNumber(item.amount) }}</view>
+          <view>{{ $t('orderDetail.walletBalanceText') }}:-{{ formatNumber(item.amount) }}</view>
           <view>{{ item.createTime }}</view>
         </view>
       </view>