Element: Datepicker Locale is wrong

Created on 5 Feb 2017  ·  5Comments  ·  Source: ElemeFE/element

ElementUI version

1.1.6

OS/Browers version

macOS/Chrome 53

Vue version

2.0.1

Reproduction Link

https://jsfiddle.net/rchcj33o/

Steps to reproduce

Set up the datepicker as described & set the locale to en-GB.
I've set my locale as follows:

import elementLocale from 'element-ui/lib/locale/lang/en';
Vue.use(ElementUI, { elementLocale });

I've not managed to update the webpack as requested because of an issue with a separate library

{
  plugins: [
    new webpack.NormalModuleReplacementPlugin(/element-ui[\/\\]lib[\/\\]locale[\/\\]lang[\/\\]zh-CN/, 'element-ui/lib/locale/lang/en')
  ]
}

I'm not sure if this should fix my issue but even if it did, I've set the locale as en-GB

What is Expected?

Locale is in English

What is actually happening?

The locale is in zn-CH

question

Most helpful comment

import elementLocale from 'element-ui/lib/locale/lang/en';
Vue.use(ElementUI, { locale: elementLocale });

{ elementLocale } will be compile to { elementLocale: elementLocale }

All 5 comments

import elementLocale from 'element-ui/lib/locale/lang/en';
Vue.use(ElementUI, { locale: elementLocale });

{ elementLocale } will be compile to { elementLocale: elementLocale }

Stupidity on my end, sorry

and thanks @QingWei-Li

Hi, when i use ONLY datepicker,

npm i element-datepicker -S
import ElDatePicker from 'element-datepicker'
Vue.use(ElDatePicker)

How can i translate? if i try elementLocale it doesnt work, someone can help me?

@rodolfosaraiva

(Element as any).locale(locale);
(Element as any).size(Cookies.get('size') || 'medium');

or in JS Pure

Element.locale(locale);
Element.size(Cookies.get('size') || 'medium');
Was this page helpful?
0 / 5 - 0 ratings