[Improvement] Locale: optimize i18 config (#701)

This commit is contained in:
neverland 2018-03-16 13:31:19 +08:00 committed by GitHub
parent 966c8afce0
commit f26ad3b912
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 65 additions and 108 deletions

View File

@ -98,7 +98,7 @@ export default {
| address_detail | Detailed Address | `String` |
| area_code | Area code | `String` |
| postal_code | Postal code | `String` |
| is_default | Is default address | `String` |
| is_default | Is default address | `Boolean` |
#### searchResult Data Structure
| key | Description | Type |

View File

@ -101,7 +101,7 @@ export default {
| address_detail | 详细地址 | `String` |
| area_code | 地区编码,通过省市区选择获取 | `String` |
| postal_code | 邮政编码 | `String` |
| is_default | 是否为默认地址 | `String` |
| is_default | 是否为默认地址 | `Boolean` |
#### searchResult 数据格式
| key | 说明 | 类型 |

View File

@ -131,7 +131,7 @@ export default {
| show-toolbar | 是否显示顶部栏 | `Boolean` | `false` | - |
| title | 顶部栏标题 | `String` | `''` | - |
| loading | 是否显示加载状态 | `Boolean` | `false` | - |
| confirm-button-text | 确认按钮文字 | `String` | `完成` | - |
| confirm-button-text | 确认按钮文字 | `String` | `确认` | - |
| cancel-button-text | 取消按钮文字 | `String` | `取消` | - |
| item-height | 选项高度 | `Number` | `44` | - |
| visible-item-count | 可见的选项个数 | `Number` | `5` | - |

View File

@ -1,8 +1,8 @@
<template>
<div ref="root">
<field
:label="$t('label.address')"
:placeholder="$t('placeholder.address')"
:label="$t('label')"
:placeholder="$t('placeholder')"
maxlength="200"
type="textarea"
autosize

View File

@ -3,7 +3,7 @@
<cell-group>
<field
maxlength="15"
:placeholder="$t('placeholder.name')"
:placeholder="$t('name')"
:label="$t('label.name', computedAddressText)"
v-model="currentInfo.name"
:error="errorInfo.name"
@ -11,8 +11,8 @@
/>
<field
type="tel"
:label="$t('label.tel')"
:placeholder="$t('placeholder.tel')"
:label="$t('tel')"
:placeholder="$t('telPlaceholder')"
v-model="currentInfo.tel"
:error="errorInfo.tel"
@focus="onFocus('tel')"
@ -20,12 +20,12 @@
<cell
clickable
class="van-address-edit__area"
:title="$t('areaTitle')"
@click="showAreaSelect = true"
:title="$t('area')"
@click="showArea = true"
>
<span>{{ currentInfo.province || $t('placeholder.province') }}</span>
<span>{{ currentInfo.city || $t('placeholder.city') }}</span>
<span>{{ currentInfo.county || $t('placeholder.county') }}</span>
<span>{{ currentInfo.province || $t('province') }}</span>
<span>{{ currentInfo.city || $t('city') }}</span>
<span>{{ currentInfo.county || $t('county') }}</span>
</cell>
<address-edit-detail
:value="currentInfo.address_detail"
@ -65,14 +65,14 @@
{{ $t('deleteAddress', computedAddressText) }}
</van-button>
</div>
<popup v-model="showAreaSelect" position="bottom">
<popup v-model="showArea" position="bottom">
<van-area
ref="area"
:loading="!areaListLoaded"
:value="currentInfo.area_code"
:area-list="areaList"
@confirm="onAreaConfirm"
@cancel="showAreaSelect = false"
@cancel="showArea = false"
/>
</popup>
</div>
@ -143,7 +143,7 @@ export default create({
data() {
return {
showAreaSelect: false,
showArea: false,
currentInfo: {
...defaultAddress,
...this.addressInfo
@ -214,11 +214,11 @@ export default create({
},
onAreaConfirm(values) {
if (values.length !== 3 || +values[0].code === -1 || +values[1].code === -1 || +values[2].code === -1) {
return Toast(this.$t('areaWrong'));
if (values.length !== 3 || values.some(value => +value.code === -1)) {
return Toast(this.$t('areaEmpty'));
}
this.assignAreaValues(values);
this.showAreaSelect = false;
this.showArea = false;
this.$emit('change-area', values);
},
@ -265,9 +265,9 @@ export default create({
case 'name':
return value ? value.length <= 15 ? '' : $t('nameOverlimit') : $t('nameEmpty');
case 'tel':
return this.telValidator(value) ? '' : $t('telWrong');
return this.telValidator(value) ? '' : $t('telInvalid');
case 'area_code':
return value ? +value !== -1 ? '' : $t('areaWrong') : $t('areaEmpty');
return value && +value !== -1 ? '' : $t('areaEmpty');
case 'address_detail':
return value ? value.length <= 200 ? '' : $t('addressOverlimit') : $t('addressEmpty');
case 'postal_code':

View File

@ -8,7 +8,7 @@
<template v-else-if="type === 'edit'">
<icon class="van-contact-card__icon" name="contact" />
<div class="van-contact-card__text">
<div>{{ $t('name') }}{{ name }}</div>
<div>{{ $t('contact') }}{{ name }}</div>
<div>{{ $t('tel') }}{{ tel }}</div>
</div>
</template>

View File

@ -4,8 +4,8 @@
<field
v-model="currentInfo.name"
maxlength="30"
:label="$t('name')"
:placeholder="$t('namePlaceholder')"
:label="$t('contact')"
:placeholder="$t('name')"
:error="errorInfo.name"
@focus="onFocus('name')"
/>

View File

@ -4,7 +4,7 @@
<cell-group>
<cell v-for="(item, index) in list" :key="item.id" is-link>
<radio :name="item.id" @click="$emit('select', item, index)">
<p class="van-contact-list__text">{{ $t('name') }}{{ item.name }}</p>
<p class="van-contact-list__text">{{ $t('contact') }}{{ item.name }}</p>
<p class="van-contact-list__text">{{ $t('tel') }}{{ item.tel }}</p>
</radio>
<icon slot="right-icon" name="edit" class="van-contact-list__edit" @click="$emit('edit', item, index)" />

View File

@ -1,28 +1,26 @@
export default {
name: 'Name',
tel: 'Phone',
save: 'Save',
confirm: 'Confirm',
cancel: 'Cancel',
save: 'Save',
complete: 'Complete',
contact: 'Name',
province: 'Province',
city: 'City',
county: 'District',
loadingTip: 'Loading...',
nameEmpty: 'Name can not be empty',
nameOverlimit: 'Name length exceeds limit',
telInvalid: 'Malformed phone number',
telPlaceholder: 'Phone',
vanContactCard: {
name: 'Name',
tel: 'Phone',
addText: 'Add contact info'
},
vanContactList: {
name: 'Name',
tel: 'Phone',
addText: 'Add new contact'
},
vanContactEdit: {
name: 'Name',
namePlaceholder: 'Name',
nameEmpty: 'Name can not be empty',
nameOverlimit: 'Name length exceeds limit',
tel: 'Phone',
telPlaceholder: 'Phone',
telInvalid: 'Malformed phone number',
save: 'Save',
delete: 'Delete',
confirmDelete: 'Are you sure you want to delete this contact?'
},
@ -31,8 +29,8 @@ export default {
next: 'Next'
},
vanPullRefresh: {
pullingText: 'Pull to refresh...',
loosingText: 'Loose to refresh...'
pulling: 'Pull to refresh...',
loosing: 'Loose to refresh...'
},
vanSubmitBar: {
label: 'Total'
@ -55,18 +53,9 @@ export default {
discount: discount => `${discount * 10}% off`,
condition: condition => `At least ${condition}`
},
vanArea: {
province: 'Province',
city: 'City',
county: 'District'
},
vanAddressEdit: {
areaTitle: 'Area',
areaWrong: 'Please select the correct receiving area',
area: 'Area',
areaEmpty: 'Please select a receiving area',
nameEmpty: 'Name can not be empty',
nameOverlimit: 'Name length exceeds limit',
telWrong: 'Wrong format of phone number',
addressOverlimit: 'The length of the address can not exceed 200 characters',
addressEmpty: 'Address can not be empty',
postalEmpty: 'Wrong postal code',
@ -75,25 +64,15 @@ export default {
confirmDelete: 'Are you sure you want to delete this address?',
label: {
name: 'Receiver',
tel: 'Phone',
postal: 'Postal'
},
placeholder: {
name: 'Receiver name',
tel: 'Phone',
postal: 'Postal code (optional)',
province: 'Province',
city: 'City',
county: 'County'
postal: 'Postal code (optional)'
}
},
vanAddressEditDetail: {
label: {
address: 'Address'
},
placeholder: {
address: 'Address'
}
label: 'Address',
placeholder: 'Address'
},
vanAddressList: {
address: 'Address',

View File

@ -1,41 +1,36 @@
export default {
name: '名字',
tel: '联系电话',
save: '保存',
confirm: '确认',
cancel: '取消',
save: '保存',
complete: '完成',
contact: '联系人',
province: '选择省份',
city: '选择城市',
county: '选择地区',
loadingTip: '加载中...',
nameEmpty: '请填写名字',
nameOverlimit: '名字过长,请重新输入',
telInvalid: '请填写正确的手机号码或电话号码',
telPlaceholder: '手机或固定电话',
vanContactCard: {
name: '联系人',
tel: '联系电话',
addText: '添加订单联系人信息'
},
vanContactList: {
name: '联系人',
tel: '联系电话',
addText: '新建联系人'
},
vanContactEdit: {
name: '联系人',
namePlaceholder: '名字',
nameEmpty: '请填写名字',
nameOverlimit: '名字过长,请重新输入',
tel: '联系电话',
telPlaceholder: '手机或固定电话',
telInvalid: '请填写正确的手机号码或电话号码',
save: '保存',
delete: '删除联系人',
confirmDelete: '确定要删除这个联系人么'
},
vanPicker: {
confirm: '完成'
},
vanPagination: {
prev: '上一页',
next: '下一页'
},
vanPullRefresh: {
pullingText: '下拉即可刷新...',
loosingText: '释放即可刷新...'
pulling: '下拉即可刷新...',
loosing: '释放即可刷新...'
},
vanSubmitBar: {
label: '合计:'
@ -58,19 +53,10 @@ export default {
discount: discount => `${discount}`,
condition: (condition) => `${condition}元可用`
},
vanArea: {
province: '选择省份',
city: '选择城市',
county: '选择地区'
},
vanAddressEdit: {
areaTitle: '收件地区',
area: '收件地区',
addressText: '收货',
areaWrong: '请选择正确的收件地区',
areaEmpty: '请选择收件地区',
nameEmpty: '请填写名字',
nameOverlimit: '名字过长,请重新输入',
telWrong: '请填写正确的手机号码或电话号码',
addressOverlimit: '详细地址不能超过200个字符',
addressEmpty: '请填写详细地址',
postalEmpty: '邮政编码格式不正确',
@ -79,25 +65,15 @@ export default {
confirmDelete: text => `确定要删除这个${text}地址么`,
label: {
name: text => `${text}`,
tel: '联系电话',
postal: '邮政编码'
},
placeholder: {
name: '名字',
tel: '手机或固定电话',
postal: '邮政编码(选填)',
province: '选择省份',
city: '选择城市',
county: '选择地区'
postal: '邮政编码(选填)'
}
},
vanAddressEditDetail: {
label: {
address: '详细地址'
},
placeholder: {
address: '如街道、楼层、门牌号等'
}
label: '详细地址',
placeholder: '如街道、楼层、门牌号等'
},
vanAddressList: {
address: '收货地址',

View File

@ -11,10 +11,10 @@
<div class="van-pull-refresh__head">
<slot name="normal" v-if="status === 'normal'"/>
<slot name="pulling" v-if="status === 'pulling'">
<span class="van-pull-refresh__text">{{ pullingText || $t('pullingText') }}</span>
<span class="van-pull-refresh__text">{{ pullingText || $t('pulling') }}</span>
</slot>
<slot name="loosing" v-if="status === 'loosing'">
<span class="van-pull-refresh__text">{{ loosingText || $t('loosingText') }}</span>
<span class="van-pull-refresh__text">{{ loosingText || $t('loosing') }}</span>
</slot>
<slot name="loading" v-if="status === 'loading'">
<div class="van-pull-refresh__loading">

View File

@ -12,7 +12,9 @@
</template>
<script>
export default {
import { create } from '../../utils';
export default create({
name: 'van-sku-row-item',
props: {
@ -55,5 +57,5 @@ export default {
}
}
}
};
});
</script>