Merge pull request #896 from QingWei-Li/fix/rename-t

Locale: rename $t to t
pull/899/head
baiyaaaaa 2016-11-08 10:36:58 +08:00 committed by GitHub
commit f2646fba4d
57 changed files with 75 additions and 75 deletions

View File

@ -8,14 +8,14 @@
:class="{ 'is-week-mode': selectionMode === 'week' }">
<tbody>
<tr>
<th v-if="showWeekNumber">{{ $t('el.datepicker.week') }}</th>
<th>{{ $t('el.datepicker.weeks.sun') }}</th>
<th>{{ $t('el.datepicker.weeks.mon') }}</th>
<th>{{ $t('el.datepicker.weeks.tue') }}</th>
<th>{{ $t('el.datepicker.weeks.wed') }}</th>
<th>{{ $t('el.datepicker.weeks.thu') }}</th>
<th>{{ $t('el.datepicker.weeks.fri') }}</th>
<th>{{ $t('el.datepicker.weeks.sat') }}</th>
<th v-if="showWeekNumber">{{ t('el.datepicker.week') }}</th>
<th>{{ t('el.datepicker.weeks.sun') }}</th>
<th>{{ t('el.datepicker.weeks.mon') }}</th>
<th>{{ t('el.datepicker.weeks.tue') }}</th>
<th>{{ t('el.datepicker.weeks.wed') }}</th>
<th>{{ t('el.datepicker.weeks.thu') }}</th>
<th>{{ t('el.datepicker.weeks.fri') }}</th>
<th>{{ t('el.datepicker.weeks.sat') }}</th>
</tr>
<tr
class="el-date-table__row"
@ -24,7 +24,7 @@
<td
v-for="cell in row"
:class="getCellClasses(cell)"
v-text="cell.type === 'today' ? $t('el.datepicker.today') : cell.text"></td>
v-text="cell.type === 'today' ? t('el.datepicker.today') : cell.text"></td>
</tr>
</tbody>
</table>

View File

@ -3,44 +3,44 @@
<tbody>
<tr>
<td :class="getCellStyle(0)">
<a class="cell">{{ $t('el.datepicker.months.jan') }}</a>
<a class="cell">{{ t('el.datepicker.months.jan') }}</a>
</td>
<td :class="getCellStyle(1)">
<a class="cell">{{ $t('el.datepicker.months.feb') }}</a>
<a class="cell">{{ t('el.datepicker.months.feb') }}</a>
</td>
<td :class="getCellStyle(2)">
<a class="cell">{{ $t('el.datepicker.months.mar') }}</a>
<a class="cell">{{ t('el.datepicker.months.mar') }}</a>
</td>
<td :class="getCellStyle(3)">
<a class="cell">{{ $t('el.datepicker.months.apr') }}</a>
<a class="cell">{{ t('el.datepicker.months.apr') }}</a>
</td>
</tr>
<tr>
<td :class="getCellStyle(4)">
<a class="cell">{{ $t('el.datepicker.months.may') }}</a>
<a class="cell">{{ t('el.datepicker.months.may') }}</a>
</td>
<td :class="getCellStyle(5)">
<a class="cell">{{ $t('el.datepicker.months.jun') }}</a>
<a class="cell">{{ t('el.datepicker.months.jun') }}</a>
</td>
<td :class="getCellStyle(6)">
<a class="cell">{{ $t('el.datepicker.months.jul') }}</a>
<a class="cell">{{ t('el.datepicker.months.jul') }}</a>
</td>
<td :class="getCellStyle(7)">
<a class="cell">{{ $t('el.datepicker.months.aug') }}</a>
<a class="cell">{{ t('el.datepicker.months.aug') }}</a>
</td>
</tr>
<tr>
<td :class="getCellStyle(8)">
<a class="cell">{{ $t('el.datepicker.months.sep') }}</a>
<a class="cell">{{ t('el.datepicker.months.sep') }}</a>
</td>
<td :class="getCellStyle(9)">
<a class="cell">{{ $t('el.datepicker.months.oct') }}</a>
<a class="cell">{{ t('el.datepicker.months.oct') }}</a>
</td>
<td :class="getCellStyle(10)">
<a class="cell">{{ $t('el.datepicker.months.nov') }}</a>
<a class="cell">{{ t('el.datepicker.months.nov') }}</a>
</td>
<td :class="getCellStyle(11)">
<a class="cell">{{ $t('el.datepicker.months.dec') }}</a>
<a class="cell">{{ t('el.datepicker.months.dec') }}</a>
</td>
</tr>
</tbody>

View File

@ -22,7 +22,7 @@
<span class="el-date-range-picker__editors-wrap">
<span class="el-date-range-picker__time-picker-wrap">
<input
:placeholder="$t('el.datepicker.startDate')"
:placeholder="t('el.datepicker.startDate')"
class="el-date-range-picker__editor"
:value="minVisibleDate"
@input="handleDateInput($event, 'min')"
@ -30,7 +30,7 @@
</span>
<span class="el-date-range-picker__time-picker-wrap">
<input
:placeholder="$t('el.datepicker.startTime')"
:placeholder="t('el.datepicker.startTime')"
class="el-date-range-picker__editor"
:value="minVisibleTime"
@focus="minTimePickerVisible = !minTimePickerVisible"
@ -49,7 +49,7 @@
<span class="el-date-range-picker__time-picker-wrap">
<input
ref="minInput"
:placeholder="$t('el.datepicker.endDate')"
:placeholder="t('el.datepicker.endDate')"
class="el-date-range-picker__editor"
:value="maxVisibleDate"
:readonly="!minDate"
@ -59,7 +59,7 @@
<span class="el-date-range-picker__time-picker-wrap">
<input
ref="maxInput"
:placeholder="$t('el.datepicker.endTime')"
:placeholder="t('el.datepicker.endTime')"
class="el-date-range-picker__editor"
:value="maxVisibleTime"
@focus="minDate && (maxTimePickerVisible = !maxTimePickerVisible)"
@ -128,12 +128,12 @@
<div class="el-picker-panel__footer" v-if="showTime">
<a
class="el-picker-panel__link-btn"
@click="handleClear">{{ $t('el.datepicker.clear') }}</a>
@click="handleClear">{{ t('el.datepicker.clear') }}</a>
<button
type="button"
class="el-picker-panel__btn"
@click="handleConfirm"
:disabled="btnDisabled">{{ $t('el.datepicker.confirm') }}</button>
:disabled="btnDisabled">{{ t('el.datepicker.confirm') }}</button>
</div>
</div>
</transition>
@ -152,11 +152,11 @@
},
leftLabel() {
return this.date.getFullYear() + ' ' + this.$t('el.datepicker.year') + ' ' + this.$t(`el.datepicker.month${ this.date.getMonth() + 1 }`);
return this.date.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t(`el.datepicker.month${ this.date.getMonth() + 1 }`);
},
rightLabel() {
return this.rightDate.getFullYear() + ' ' + this.$t('el.datepicker.year') + ' ' + this.$t(`el.datepicker.month${ this.rightDate.getMonth() + 1 }`);
return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t(`el.datepicker.month${ this.rightDate.getMonth() + 1 }`);
},
leftYear() {

View File

@ -23,7 +23,7 @@
<div class="el-date-picker__time-header" v-if="showTime">
<span class="el-date-picker__editor-wrap">
<input
:placehoder="$t('el.datepicker.selectDate')"
:placehoder="t('el.datepicker.selectDate')"
type="text"
v-model.lazy="visibleDate"
class="el-date-picker__editor">
@ -33,7 +33,7 @@
ref="input"
@focus="timePickerVisible = !timePickerVisible"
v-model.lazy="visibleTime"
:placehoder="$t('el.datepicker.selectTime')"
:placehoder="t('el.datepicker.selectTime')"
type="text"
class="el-date-picker__editor">
<time-picker
@ -64,7 +64,7 @@
@click="showMonthPicker"
v-show="currentView === 'date'"
class="el-date-picker__header-label"
:class="{ active: currentView === 'month' }">{{$t(`el.datepicker.month${ month + 1 }`)}}</span>
:class="{ active: currentView === 'month' }">{{t(`el.datepicker.month${ month + 1 }`)}}</span>
<button
type="button"
@click="nextYear"
@ -115,11 +115,11 @@
<a
href="JavaScript:"
class="el-picker-panel__link-btn"
@click="changeToNow">{{ $t('el.datepicker.now') }}</a>
@click="changeToNow">{{ t('el.datepicker.now') }}</a>
<button
type="button"
class="el-picker-panel__btn"
@click="confirm">{{ $t('el.datepicker.confirm') }}</button>
@click="confirm">{{ t('el.datepicker.confirm') }}</button>
</div>
</div>
</transition>
@ -421,7 +421,7 @@
yearLabel() {
const year = this.year;
if (!year) return '';
const yearTranslation = this.$t('el.datepicker.year');
const yearTranslation = this.t('el.datepicker.year');
if (this.currentView === 'year') {
const startYear = Math.floor(year / 10) * 10;
return startYear + ' ' + yearTranslation + '-' + (startYear + 9) + ' ' + yearTranslation;

View File

@ -6,7 +6,7 @@
class="el-time-range-picker el-picker-panel">
<div class="el-time-range-picker__content">
<div class="el-time-range-picker__cell">
<div class="el-time-range-picker__header">{{ $t('el.datepicker.startTime') }}</div>
<div class="el-time-range-picker__header">{{ t('el.datepicker.startTime') }}</div>
<div class="el-time-range-picker__body el-time-panel__content">
<time-spinner
ref="minSpinner"
@ -20,7 +20,7 @@
</div>
</div>
<div class="el-time-range-picker__cell">
<div class="el-time-range-picker__header">{{ $t('el.datepicker.endTime') }}</div>
<div class="el-time-range-picker__header">{{ t('el.datepicker.endTime') }}</div>
<div class="el-time-range-picker__body el-time-panel__content">
<time-spinner
ref="maxSpinner"
@ -38,12 +38,12 @@
<button
type="button"
class="el-time-panel__btn cancel"
@click="handleCancel()">{{ $t('el.datepicker.cancel') }}</button>
@click="handleCancel()">{{ t('el.datepicker.cancel') }}</button>
<button
type="button"
class="el-time-panel__btn confirm"
@click="handleConfirm()"
:disabled="btnDisabled">{{ $t('el.datepicker.confirm') }}</button>
:disabled="btnDisabled">{{ t('el.datepicker.confirm') }}</button>
</div>
</div>
</transition>

View File

@ -19,11 +19,11 @@
<button
type="button"
class="el-time-panel__btn cancel"
@click="handleCancel">{{ $t('el.datepicker.cancel') }}</button>
@click="handleCancel">{{ t('el.datepicker.cancel') }}</button>
<button
type="button"
class="el-time-panel__btn confirm"
@click="handleConfirm()">{{ $t('el.datepicker.confirm') }}</button>
@click="handleConfirm()">{{ t('el.datepicker.confirm') }}</button>
</div>
</div>
</transition>

View File

@ -1,7 +1,7 @@
import { $t } from 'element-ui/src/locale';
import { t } from 'element-ui/src/locale';
const CONFIRM_TEXT = $t('el.messagebox.confirm');
const CANCEL_TEXT = $t('el.messagebox.cancel');
const CONFIRM_TEXT = t('el.messagebox.confirm');
const CANCEL_TEXT = t('el.messagebox.cancel');
const defaults = {
title: '提示',

View File

@ -28,7 +28,7 @@
import ElInput from 'element-ui/packages/input';
import ElButton from 'element-ui/packages/button';
import { addClass, removeClass } from 'wind-dom/src/class';
import { $t } from 'element-ui/src/locale';
import { t } from 'element-ui/src/locale';
let typeMap = {
success: 'circle-check',
@ -120,7 +120,7 @@
if (this.$type === 'prompt') {
var inputPattern = this.inputPattern;
if (inputPattern && !inputPattern.test(this.inputValue || '')) {
this.editorErrorMessage = this.inputErrorMessage || $t('el.messagebox.error');
this.editorErrorMessage = this.inputErrorMessage || t('el.messagebox.error');
addClass(this.$refs.input.$el.querySelector('input'), 'invalid');
return false;
}
@ -128,7 +128,7 @@
if (typeof inputValidator === 'function') {
var validateResult = inputValidator(this.inputValue);
if (validateResult === false) {
this.editorErrorMessage = this.inputErrorMessage || $t('el.messagebox.error');
this.editorErrorMessage = this.inputErrorMessage || t('el.messagebox.error');
addClass(this.$refs.input.$el.querySelector('input'), 'invalid');
return false;
}
@ -184,8 +184,8 @@
inputErrorMessage: '',
showConfirmButton: true,
showCancelButton: false,
confirmButtonText: $t('el.messagebox.confirm'),
cancelButtonText: $t('el.messagebox.cancel'),
confirmButtonText: t('el.messagebox.confirm'),
cancelButtonText: t('el.messagebox.cancel'),
confirmButtonClass: '',
confirmButtonDisabled: false,
cancelButtonClass: '',

View File

@ -2,7 +2,7 @@ import Pager from './pager.vue';
import ElSelect from 'element-ui/packages/select';
import ElOption from 'element-ui/packages/option';
import Migrating from 'element-ui/src/mixins/migrating';
import { $t } from 'element-ui/src/locale';
import { t } from 'element-ui/src/locale';
export default {
name: 'ElPagination',
@ -137,7 +137,7 @@ export default {
this.$parent.pageSizes.map(item =>
<el-option
value={ item }
label={ item + ' ' + $t('el.pagination.pagesize') }>
label={ item + ' ' + t('el.pagination.pagesize') }>
</el-option>
)
}
@ -183,7 +183,7 @@ export default {
render(h) {
return (
<span class="el-pagination__jump">
{ $t('el.pagination.goto') }
{ t('el.pagination.goto') }
<input
class="el-pagination__editor"
type="number"
@ -194,7 +194,7 @@ export default {
on-focus={ this.handleFocus }
style={{ width: '30px' }}
number/>
{ $t('el.pagination.pageClassifier') }
{ t('el.pagination.pageClassifier') }
</span>
);
}
@ -204,7 +204,7 @@ export default {
render(h) {
return (
typeof this.$parent.total === 'number'
? <span class="el-pagination__total">{ $t('el.pagination.total', { total: this.$parent.total }) }</span>
? <span class="el-pagination__total">{ t('el.pagination.total', { total: this.$parent.total }) }</span>
: ''
);
}

View File

@ -73,7 +73,7 @@
import Clickoutside from 'element-ui/src/utils/clickoutside';
import { addClass, removeClass, hasClass } from 'wind-dom/src/class';
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
import { $t } from 'element-ui/src/locale';
import { t } from 'element-ui/src/locale';
export default {
mixins: [Emitter, Locale],
@ -110,17 +110,17 @@
emptyText() {
if (this.loading) {
return this.$t('el.select.loading');
return this.t('el.select.loading');
} else {
if (this.voidRemoteQuery) {
this.voidRemoteQuery = false;
return false;
}
if (this.filterable && this.filteredOptionsCount === 0) {
return this.$t('el.select.noMatch');
return this.t('el.select.noMatch');
}
if (this.options.length === 0) {
return this.$t('el.select.noData');
return this.t('el.select.noData');
}
}
return null;
@ -149,7 +149,7 @@
multiple: Boolean,
placeholder: {
type: String,
default: $t('el.select.placeholder')
default: t('el.select.placeholder')
}
},

View File

@ -11,15 +11,15 @@
<div class="el-table-filter__bottom">
<button @click="handleConfirm"
:class="{ 'is-disabled': filteredValue.length === 0 }"
:disabled="filteredValue.length === 0">{{ $t('el.table.confirmFilter') }}</button>
<button @click="handleReset">{{ $t('el.table.resetFilter') }}</button>
:disabled="filteredValue.length === 0">{{ t('el.table.confirmFilter') }}</button>
<button @click="handleReset">{{ t('el.table.resetFilter') }}</button>
</div>
</div>
<div class="el-table-filter" v-else v-show="showPopper">
<ul class="el-table-filter__list">
<li class="el-table-filter__list-item"
:class="{ 'is-active': !filterValue }"
@click="handleSelect(null)">{{ $t('el.table.clearFilter') }}</li>
@click="handleSelect(null)">{{ t('el.table.clearFilter') }}</li>
<li class="el-table-filter__list-item"
v-for="filter in filters"
:label="filter.value"
@ -64,8 +64,8 @@
<div class="el-table-filter__content">
</div>
<div class="el-table-filter__bottom">
<button on-click={ this.handleConfirm }>{ this.$t('el.table.confirmFilter') }</button>
<button on-click={ this.handleReset }>{ this.$t('el.table.resetFilter') }</button>
<button on-click={ this.handleConfirm }>{ this.t('el.table.confirmFilter') }</button>
<button on-click={ this.handleReset }>{ this.t('el.table.resetFilter') }</button>
</div>
</div>);
},

View File

@ -94,7 +94,7 @@
import throttle from 'throttle-debounce/throttle';
import debounce from 'throttle-debounce/debounce';
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
import { $t } from 'element-ui/src/locale';
import { t } from 'element-ui/src/locale';
import TableStore from './table-store';
import TableLayout from './table-layout';
import TableBody from './table-body';
@ -137,7 +137,7 @@
emptyText: {
type: String,
default: $t('el.table.emptyText')
default: t('el.table.emptyText')
}
},

View File

@ -19,9 +19,9 @@
<transition name="fade-in">
<div v-show="mouseover" class="el-dragger__cover__interact">
<div class="el-draggeer__cover__btns">
<span class="btn" @click="$parent.handleClick()"><i class="el-icon-upload2"></i><span>{{ $t('el.upload.continue') }}</span></span>
<span class="btn" @click="onPreview(image)"><i class="el-icon-view"></i><span>{{ $t('el.upload.preview') }}</span></span>
<span class="btn" @click="onRemove(image)"><i class="el-icon-delete2"></i><span>{{ $t('el.upload.delete') }}</span></span>
<span class="btn" @click="$parent.handleClick()"><i class="el-icon-upload2"></i><span>{{ t('el.upload.continue') }}</span></span>
<span class="btn" @click="onPreview(image)"><i class="el-icon-view"></i><span>{{ t('el.upload.preview') }}</span></span>
<span class="btn" @click="onRemove(image)"><i class="el-icon-delete2"></i><span>{{ t('el.upload.delete') }}</span></span>
</div>
</div>
</transition>

View File

@ -12,7 +12,7 @@
<a class="el-upload__file__name" @click="$emit('preview', file)">
<i class="el-icon-document"></i>{{file.name}}
</a>
<span class="el-upload__btn-delete" @click="$emit('remove', file)" v-show="file.status === 'finished'">{{ $t('el.upload.delete') }}</span>
<span class="el-upload__btn-delete" @click="$emit('remove', file)" v-show="file.status === 'finished'">{{ t('el.upload.delete') }}</span>
<el-progress
v-if="file.showProgress"
:stroke-width="2"

View File

@ -7,7 +7,7 @@ const format = Format(Vue);
let lang = defaultLang;
let merged = false;
export const $t = function(path, options) {
export const t = function(path, options) {
const vuei18n = Object.getPrototypeOf(this || Vue).$t;
if (typeof vuei18n === 'function') {
if (!merged) {
@ -32,4 +32,4 @@ export const $t = function(path, options) {
export const use = function(l) {
lang = l || lang;
};
export default { use, $t };
export default { use, t };

View File

@ -1,9 +1,9 @@
import { $t } from 'element-ui/src/locale';
import { t } from 'element-ui/src/locale';
export default {
methods: {
$t(...args) {
return $t.apply(this, args);
t(...args) {
return t.apply(this, args);
}
}
};