國(guó)際化翻譯遇到的問(wèn)題與解決方案:
國(guó)際化項(xiàng)目部署情況:uni-app系列----項(xiàng)目國(guó)際化
?
?
1.文字的替換方法:
跟訪(fǎng)問(wèn)data數(shù)據(jù) 一樣,{{}}實(shí)現(xiàn)數(shù)據(jù)綁定:
搜索 {{i18n.search}}
?
2.標(biāo)簽內(nèi)屬性值的替換方法:
用? "? : " 即 “ v-bind”進(jìn)行綁定訪(fǎng)問(wèn):注意冒號(hào)
:placeholder="i18n.mobilePhone" type="number" maxlength="11" @input="onMobileInput">
3.標(biāo)簽或文本內(nèi)的三木運(yùn)算判斷的替換方法:
{{userLevelInfo.levelType==1? wxs.spliceDate(userLevelInfo.endTime)+"1111":"22222"}} {{userLevelInfo.levelType==1? wxs.spliceDate(userLevelInfo.endTime)+i18n.expire:i18n.notPayingMember}}
{{currentLevelId==item.id?"111":"222"}} {{currentLevelId==item.id?i18n.current:i18n.notPurchased}}
4.data里數(shù)值的替換方法:
不能直接?i18n. 進(jìn)行訪(fǎng)問(wèn),只能用在函數(shù)中用 push 方法添加進(jìn)去
一些對(duì)象的屬性也可以這樣添加實(shí)現(xiàn)!
// refundPriReasonArray: ['請(qǐng)選擇', '協(xié)商一致退款', '拍錯(cuò)/多拍/不喜歡', '其他'], refundPriReasonArray: [i18n.pleaseChoose, i18n.refundConsensus, i18n.wrongShot, i18n.other],//無(wú)法訪(fǎng)問(wèn)
data里:
refundPriReasonArray:[],
函數(shù)
{
this.refundPriReasonArray.push(i18n.pleaseChoose, i18n.refundConsensus, i18n.wrongShot, i18n.other);
console.log(this.refundPriReasonArray)
}
5.彈窗文字的替換方法:
用 this 進(jìn)行訪(fǎng)問(wèn),同訪(fǎng)問(wèn) data 數(shù)據(jù)
uni.showModal({ title: "提示", content: "請(qǐng)輸入正確的信息!", success: res => { if (res.confirm) { this.popupShow = true } else {} } });
uni.showModal({ title: this.i18n.tips, content: this.i18n.upgradeMemberTips1, success: res => { if (res.confirm) { this.popupShow = true } else {} } });
?
6.下方導(dǎo)航標(biāo)簽的替換方法
?
?
?只能一次設(shè)置一個(gè),所以要設(shè)多個(gè)
?
?
記得城市換調(diào)用與渲染
?
?
?
7.頁(yè)面標(biāo)題的替換方法
?
?
?用
uni.setNavigationBarTitle({
});
uni.setNavigationBarTitle({ title:this.i18n.yamiMultiStore });
再每個(gè)頁(yè)面都要設(shè)置。愛(ài)掏網(wǎng) - it200.com。愛(ài)掏網(wǎng) - it200.com。愛(ài)掏網(wǎng) - it200.com。愛(ài)掏網(wǎng) - it200.com。愛(ài)掏網(wǎng) - it200.com一百多個(gè)頁(yè)面文件,就是手指有點(diǎn)抽筋。愛(ài)掏網(wǎng) - it200.com。愛(ài)掏網(wǎng) - it200.com。愛(ài)掏網(wǎng) - it200.com。愛(ài)掏網(wǎng) - it200.com
我是放在onShow里面的
?
?
8.?js文件文字的替換方法
終于解決了。愛(ài)掏網(wǎng) - it200.comhhhhhhhhhh,弄了一個(gè)早上,搞定了是真的開(kāi)心呀
下面的彈窗就是再js文件里設(shè)置的,搞定了!
?
?
?方法:
?
?
?
?
?
9.彈窗補(bǔ)充(wx.showModal與uni.showModal)
wx.showModal:http://www.mamicode.com/info-detail-2373042.html
uni.showModal: https://www.kancloud.cn/guobaoguo/uniapp/820872
?
?
?
?
?
?
解決:
?
?
?
?注意:this指向問(wèn)題:
?
?
?
?
詳細(xì)請(qǐng)結(jié)合參考官網(wǎng):https://uniapp.dcloud.io/api/ui/tabbar?id=settabbaritem
https://ask.dcloud.net.cn/article/35872