Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add i18n for components #678

Merged
merged 1 commit into from
Oct 27, 2016
Merged

Add i18n for components #678

merged 1 commit into from
Oct 27, 2016

Conversation

QingWei-Li
Copy link
Contributor

Please makes sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow Element's Contributing Guide.
  • Rebase before creating a PR to keep commit history clear.
  • Add some descriptions and refer relative issues for you PR.

引入全部组件

import Vue from 'vue'
import ElementUI from 'element-ui'
import locale from 'element-ui/lib/locale/lang/en'

Vue.use(ElementUI, { locale })

按需加载组件

只需要全局调用下 locale#use 设置语言即可

import Vue from 'vue'
import { DatePicker } from 'element-ui'
import lang from 'element-ui/lib/locale/lang/en'
import locale from 'element-ui/lib/locale'

// 设置语言
locale.use(lang)

// 引入组件
Vue.use(DatePicker)

移除默认语言包(需要配合 webpack)

默认是加载 zh-cn 语言包的,如果选择了其他语言就不需要加载默认的包,配合 webpack 的 ignorePlugin

{
  plugins: [
    new webpack.IgnorePlugin(/element-ui\/lib\/locale\/lang\/zh-cn$/)
  ]
}

单独的小包

需要配合 vue-i18n 自己配置

@Leopoldthecoder
Copy link
Contributor

合了之后我把 en 的配置文件更新

@furybean furybean merged commit f960ea5 into ElemeFE:master Oct 27, 2016
@QingWei-Li QingWei-Li deleted the feat/locale branch October 27, 2016 10:40
furybean pushed a commit that referenced this pull request Nov 3, 2016
* Update test config

* Alert: add test

* col test improve

* Popover: add test

* add checkbox test

* Loading: add test (#540)

* add radio test

* Badge: add test

* Tab: add test

* Select: add resize event

* Card: add test

* input test improve

* DatePicker: Optimize the input, fixed #484 (#543)

* Upload: fix links in the doc (#553)

* tag test improve (#552)

* fix input-number style

* Message: add test

* Slider: improve test (#554)

* Steps: add test (#561)

* Notification: add test (#565)

* add input-number test

* Pagination: add test

* [Table] Remove prop: selectionMode & allowNoCurrentRow

* Update quickstart.md

change 「Element UI」 to 「Element」

* fix some potential test err

* add progress test

* [Table] Add Migrating tip for table & rename cell-mouse* event to cell-mouse-* (#572)

* add menu test

* Clickoutside: add test & improve vue-popper test (#577)

* [Table] Improve fixed implement method.

* Tooltip: Improve hover test (#581)

* Remove whitespace in vue template

* Clickoutside: removing  element from the queue

* fix input native props

* fix tabs style (#588)

* Message/Notification: improve test

* Tooltip: add manual feature

* Slider: add disabled/use tooltip (#589)

* MessageBox: update animation/add test

* Override linguist language (#596)

* Add v-sync directive. (#598)

* add autocomplete size (#600)

* DatePicker: fix trigger multiple watch, fixed #597

* Alert: improve test (#605)

* Improve v-sync test. (#603)

* Homepage: replace index imgs

* add autocomplete test

* Table: add hover background. (#609)

* vue-popper: fix a node removal bug (#617)

* add tabs test

* add dropdown test

* breadcrumb: add test (#629)

* fix masses style

* Fix import src file multiple times, fixed #634 #630

* Table: add test

Remove fuck

* Select: add test (#636)

* TimeSelect: improve test

* Test: add destroy

* Update externals (#641)

* Table: add empty text

* add support for change by keyboard event (#648)

* TimePicker: improve test

* Menu: add menu-trigger prop (#649)

* Pagination: rename currentchange & sizechange.

* Popper: set base zIndex to 2000 (#664)

* Test: add Dialog and vue-popup (#662)

* fixed no-unused-vars (#654)

* Fix build src folder, fixed #665

* DatePicker: improve test (#659)

* iframe upload use post message to get the res content

* Tree: add test (#679)

* Add locale feature (#678)

fix

* Update build config

* i18n: add English config (#685)

* Table: add filter feature. (#684)

* Test/component/form (#687)

Form: add test

* Table: add filter test

a

a

* Table: add column remote/custom sort.

* Table: add sortable test

* Fix test config

* fix dropdown menu visible bug

* doc: add installation

* Upload(doc): show-uploadList => show-upload-list, fixed #680 (#697)

* InputNumber: fix button style (#698)

* update quickstart

* Locale: add format

* Add auto build lib

* Button: add click event (#703)

* Pagination: add missing i18n config (#701)

* misc updates (#705)

* i18n: add German config

* travis: fix shell

* update changelog

* [build] 1.0.0-rc.8

* [release] 1.0.0-rc.8

* travis: auto build site

* doc: add ignore locale

* Dialog: update doc

* MessageBox: fix a callback overwriting bug

* Deploy-ci: fix shell

* Table: fix a doc typo (#723)

* Table: fix show tooltip, fixed #714 (#717)

* package.json: add cross-env

* Clickoutside: fix id of undefined, fixed #720

* Table(doc): update inline-template, #726

* support button autofocus && autofocus message box confirm button

* replace _componentTag to componentName

* MessageBox: autofocus confirm button

* Update the cjs files naming

* Popover: fix focus trigger, fixed #734

* Docs: add i18n.md (#740)

* dropdown: add command api

* TimePicker: hidden scrollbar in IE10

* DatePicker: fix dont select the time on the same day

* Pagination: emit 'current-page' when sizes change, closed #729

* Add CDNJS version badge in readme (#746)

* Form(doc): fix submit event

* Table: add min-width prop doc.

* Theme-default: add variables

* fix docs

* travis: remove files but ignore readme.md

* Tooltip: fix arrow offset style

* DatePicker: fix test

* input-number: style fix && experience improve

* Slider: fix display issue inside Form

* Select: fix an input initial height bug

* migrate theme-deafult repo

* add test && fix ajax response in callback (#767)

* Table: rename hidden class to is-hidden.

* Table: fixed firefox bug. fixed #766. (#769)

* Update build theme config

* Move vue to peerDependencies (#774)

* Move vue to peerDependencies

* Update package.json

* fixup

* package.json: Update scripts

* Remove submodule

* doc: add custom theme

* Select: fix a form validation bug

* unit test vm destroy improve (#791)

* Table: let table compatible with vuex.

* Message, Notification: fix transitionend bug

问题描述:
如果我在组件中加入不同的transition或者transition: all
duration的形式,那么this.$el.addEventListener(‘transitioned’,
handeler)就会监听到多次事件,从而导致多次删除,因为节点已经从dom中删除,
所以最后报错:
’main.vue?8f52:44
Uncaught TypeError: Cannot read property 'removeChild' of null’。
解决办法:
就是在第一次监听到动画结束事件时,将监听器移除即可。

* init i18n

* finish page templates

* update i18n

* update router

* finish router

* add design discipline translation

* fix a typo

* add navigation translation

* delete verbose codes

* update component i18n

* update new.js

* add new-lang

* finish index translation

* update theatre configs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants