Commit bff90818cf1cd1b89beda95aceb0d3b7edec5516

Authored by Aresn
Committed by GitHub
2 parents 4ab1ac53 5fbe80fe

Merge pull request #2351 from SergioCrisostomo/i18n

use dist's locale
Showing 2 changed files with 7 additions and 38 deletions   Show diff stats
@@ -50,7 +50,6 @@ import Upload from './components/upload'; @@ -50,7 +50,6 @@ import Upload from './components/upload';
50 import {Row, Col} from './components/grid'; 50 import {Row, Col} from './components/grid';
51 import {Select, Option, OptionGroup} from './components/select'; 51 import {Select, Option, OptionGroup} from './components/select';
52 import locale from './locale/index'; 52 import locale from './locale/index';
53 -import locales from './locale/locales';  
54 53
55 const iview = { 54 const iview = {
56 Affix, 55 Affix,
@@ -155,7 +154,6 @@ module.exports = { // eslint-disable-line no-undef @@ -155,7 +154,6 @@ module.exports = { // eslint-disable-line no-undef
155 locale: locale.use, 154 locale: locale.use,
156 i18n: locale.i18n, 155 i18n: locale.i18n,
157 install, 156 install,
158 - locales,  
159 Affix, 157 Affix,
160 Alert, 158 Alert,
161 AutoComplete, 159 AutoComplete,
@@ -223,4 +221,10 @@ module.exports = { // eslint-disable-line no-undef @@ -223,4 +221,10 @@ module.exports = { // eslint-disable-line no-undef
223 Upload 221 Upload
224 }; 222 };
225 223
226 -module.exports.default = module.exports; // eslint-disable-line no-undef  
227 \ No newline at end of file 224 \ No newline at end of file
  225 +module.exports.lang = (code) => { // eslint-disable-line no-undef
  226 + const langObject = window['iview/locale'].default;
  227 + if (code === langObject.i.locale) locale.use(langObject);
  228 + else console.log(`The ${code} language pack is not loaded.`); // eslint-disable-line no-console
  229 +};
  230 +
  231 +module.exports.default = module.exports; // eslint-disable-line no-undef
src/locale/locales.js deleted
1 -// export all locale files  
2 -  
3 -import deDE from './lang/de-DE.js';  
4 -import enUS from './lang/en-US.js';  
5 -import esES from './lang/es-ES.js';  
6 -import frFR from './lang/fr-FR.js';  
7 -import idID from './lang/id-ID.js';  
8 -import jaJP from './lang/ja-JP.js';  
9 -import koKR from './lang/ko-KR.js';  
10 -import ptBR from './lang/pt-BR.js';  
11 -import ptPT from './lang/pt-PT.js';  
12 -import ruRU from './lang/ru-RU.js';  
13 -import svSE from './lang/sv-SE.js';  
14 -import trTR from './lang/tr-TR.js';  
15 -import viVN from './lang/vi-VN.js';  
16 -import zhCN from './lang/zh-CN.js';  
17 -import zhTW from './lang/zh-TW.js';  
18 -  
19 -export default {  
20 - 'de-DE': deDE,  
21 - 'en-US': enUS,  
22 - 'es-ES': esES,  
23 - 'fr-FR': frFR,  
24 - 'id-ID': idID,  
25 - 'ja-JP': jaJP,  
26 - 'ko-KR': koKR,  
27 - 'pt-BR': ptBR,  
28 - 'pt-PT': ptPT,  
29 - 'ru-RU': ruRU,  
30 - 'sv-SE': svSE,  
31 - 'tr-TR': trTR,  
32 - 'vi-VN': viVN,  
33 - 'zh-CN': zhCN,  
34 - 'zh-TW': zhTW  
35 -};