feat: 演示i18n

This commit is contained in:
菲鸽 2024-06-16 15:21:44 +08:00
parent 09477e60eb
commit 3c2d52e060
3 changed files with 6 additions and 6 deletions

View File

@ -1,8 +1,8 @@
{ {
"tabbar.home": "Home", "tabbar.home": "Home",
"tabbar.about": "About", "tabbar.about": "About",
"app.name": "En Title",
"weight": "{heavy}KG", "weight": "{heavy}KG",
"weight2": "{0}KG", "detail": "{0}cm, {1}KG",
"introduction": "I am {name},height:{detail.height},weight:{detail.weight}", "introduction": "I am {name},height:{detail.height},weight:{detail.weight}"
"app.name": "En Title"
} }

View File

@ -3,6 +3,6 @@
"tabbar.about": "关于", "tabbar.about": "关于",
"app.name": "中文标题", "app.name": "中文标题",
"weight": "{heavy}公斤", "weight": "{heavy}公斤",
"introduction": "我是 {name},身高:{detail.height},体重:{detail.weight}", "detail": "{0}cm, {1}公斤",
"weight2": "{0}公斤" "introduction": "我是 {name},身高:{detail.height},体重:{detail.weight}"
} }

View File

@ -22,7 +22,7 @@
<view class="text-green-500">多语言测试</view> <view class="text-green-500">多语言测试</view>
<view class="m-4">{{ $t('app.name') }}</view> <view class="m-4">{{ $t('app.name') }}</view>
<view class="m-4">{{ $t('weight', { heavy: 100 }) }}</view> <view class="m-4">{{ $t('weight', { heavy: 100 }) }}</view>
<view class="m-4">{{ formatString(translate('weight2'), 100) }}</view> <view class="m-4">{{ formatString(translate('detail'), 175, 60) }}</view>
<view class="m-4"> <view class="m-4">
{{ formatI18n(translate('introduction'), user) }} {{ formatI18n(translate('introduction'), user) }}
</view> </view>