Commit a5dad1afd481bae320468c2a629d4cb00f36dec0

Authored by 梁灏
1 parent 6b2af1b6

fixed #1090 & close #2387 #2379

src/locale/index.js
... ... @@ -45,4 +45,16 @@ export const i18n = function(fn) {
45 45 i18nHandler = fn || i18nHandler;
46 46 };
47 47  
48   -export default { use, t, i18n };
49 48 \ No newline at end of file
  49 +// using with vue-i18n in CDN
  50 +/*eslint-disable */
  51 +export const setLang = function (l) {
  52 + if (typeof window.iview !== 'undefined') {
  53 + if (!('langs' in iview)) {
  54 + iview.langs = {};
  55 + }
  56 + iview.langs[l] = lang;
  57 + }
  58 +};
  59 +/*eslint-enable */
  60 +
  61 +export default { use, t, i18n, setLang };
50 62 \ No newline at end of file
... ...
src/locale/lang/de-DE.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'de-DE',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/en-US.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'en-US',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/es-ES.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'es-ES',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/fr-FR.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'fr-FR',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/id-ID.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'id-ID',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/ja-JP.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'ja-JP',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/ko-KR.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'ko-KR',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/pt-BR.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'pt-BR',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/pt-PT.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'pt-PT',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/ru-RU.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'ru-RU',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/sv-SE.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'sv-SE',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/tr-TR.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'tr-TR',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/uk-UA.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'uk-UA',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/vi-VN.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'vi-VN',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...
src/locale/lang/zh-CN.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'zh-CN',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
... ...
src/locale/lang/zh-TW.js
1   -export default {
  1 +import { setLang } from '../index';
  2 +
  3 +const lang = {
2 4 i: {
3 5 locale: 'zh-TW',
4 6 select: {
... ... @@ -97,3 +99,7 @@ export default {
97 99 }
98 100 }
99 101 };
  102 +
  103 +setLang(lang.i.locale);
  104 +
  105 +export default lang;
100 106 \ No newline at end of file
... ...