From 5bd0f522994728f75251583c2e0e03dfc5c869b3 Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Mon, 13 Nov 2017 09:44:56 +0800 Subject: [PATCH] fixed --- src/locale/index.js | 14 +------------- src/locale/lang.js | 11 +++++++++++ src/locale/lang/de-DE.js | 4 ++-- src/locale/lang/en-US.js | 4 ++-- src/locale/lang/es-ES.js | 4 ++-- src/locale/lang/fr-FR.js | 4 ++-- src/locale/lang/id-ID.js | 4 ++-- src/locale/lang/ja-JP.js | 4 ++-- src/locale/lang/ko-KR.js | 4 ++-- src/locale/lang/pt-BR.js | 4 ++-- src/locale/lang/pt-PT.js | 4 ++-- src/locale/lang/ru-RU.js | 4 ++-- src/locale/lang/sv-SE.js | 4 ++-- src/locale/lang/tr-TR.js | 4 ++-- src/locale/lang/uk-UA.js | 4 ++-- src/locale/lang/vi-VN.js | 4 ++-- src/locale/lang/zh-CN.js | 4 ++-- src/locale/lang/zh-TW.js | 4 ++-- 18 files changed, 44 insertions(+), 45 deletions(-) create mode 100644 src/locale/lang.js diff --git a/src/locale/index.js b/src/locale/index.js index 4e40ce3..c5b6b60 100644 --- a/src/locale/index.js +++ b/src/locale/index.js @@ -45,16 +45,4 @@ export const i18n = function(fn) { i18nHandler = fn || i18nHandler; }; -// using with vue-i18n in CDN -/*eslint-disable */ -export const setLang = function (name, lang) { - if (typeof window.iview !== 'undefined') { - if (!('langs' in iview)) { - iview.langs = {}; - } - iview.langs[name] = lang; - } -}; -/*eslint-enable */ - -export default { use, t, i18n, setLang }; \ No newline at end of file +export default { use, t, i18n }; \ No newline at end of file diff --git a/src/locale/lang.js b/src/locale/lang.js new file mode 100644 index 0000000..62929e0 --- /dev/null +++ b/src/locale/lang.js @@ -0,0 +1,11 @@ +// using with vue-i18n in CDN +/*eslint-disable */ +export default function (lang) { + if (typeof window.iview !== 'undefined') { + if (!('langs' in iview)) { + iview.langs = {}; + } + iview.langs[lang.i.locale] = lang; + } +}; +/*eslint-enable */ \ No newline at end of file diff --git a/src/locale/lang/de-DE.js b/src/locale/lang/de-DE.js index daefbb1..d0fe5d3 100644 --- a/src/locale/lang/de-DE.js +++ b/src/locale/lang/de-DE.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/en-US.js b/src/locale/lang/en-US.js index 6940d8f..f964107 100644 --- a/src/locale/lang/en-US.js +++ b/src/locale/lang/en-US.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/es-ES.js b/src/locale/lang/es-ES.js index 44b6825..dd86f85 100644 --- a/src/locale/lang/es-ES.js +++ b/src/locale/lang/es-ES.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/fr-FR.js b/src/locale/lang/fr-FR.js index a6a4203..d6e8167 100644 --- a/src/locale/lang/fr-FR.js +++ b/src/locale/lang/fr-FR.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/id-ID.js b/src/locale/lang/id-ID.js index fc73bc1..3e46783 100644 --- a/src/locale/lang/id-ID.js +++ b/src/locale/lang/id-ID.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/ja-JP.js b/src/locale/lang/ja-JP.js index 16204b7..1499bda 100644 --- a/src/locale/lang/ja-JP.js +++ b/src/locale/lang/ja-JP.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/ko-KR.js b/src/locale/lang/ko-KR.js index 50dbf48..0c49b8e 100644 --- a/src/locale/lang/ko-KR.js +++ b/src/locale/lang/ko-KR.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/pt-BR.js b/src/locale/lang/pt-BR.js index dc54899..1b756e1 100644 --- a/src/locale/lang/pt-BR.js +++ b/src/locale/lang/pt-BR.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/pt-PT.js b/src/locale/lang/pt-PT.js index f125865..6cf1006 100644 --- a/src/locale/lang/pt-PT.js +++ b/src/locale/lang/pt-PT.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/ru-RU.js b/src/locale/lang/ru-RU.js index 0c1d414..02ab8c2 100644 --- a/src/locale/lang/ru-RU.js +++ b/src/locale/lang/ru-RU.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/sv-SE.js b/src/locale/lang/sv-SE.js index e0e7ced..c9beb86 100644 --- a/src/locale/lang/sv-SE.js +++ b/src/locale/lang/sv-SE.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/tr-TR.js b/src/locale/lang/tr-TR.js index 2e1a884..692ebba 100644 --- a/src/locale/lang/tr-TR.js +++ b/src/locale/lang/tr-TR.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/uk-UA.js b/src/locale/lang/uk-UA.js index 115c9f2..38547fd 100644 --- a/src/locale/lang/uk-UA.js +++ b/src/locale/lang/uk-UA.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/vi-VN.js b/src/locale/lang/vi-VN.js index 165714a..a7e3910 100644 --- a/src/locale/lang/vi-VN.js +++ b/src/locale/lang/vi-VN.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file diff --git a/src/locale/lang/zh-CN.js b/src/locale/lang/zh-CN.js index 74ad7d1..a58421e 100644 --- a/src/locale/lang/zh-CN.js +++ b/src/locale/lang/zh-CN.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; diff --git a/src/locale/lang/zh-TW.js b/src/locale/lang/zh-TW.js index 424e6d8..2acd81d 100644 --- a/src/locale/lang/zh-TW.js +++ b/src/locale/lang/zh-TW.js @@ -1,4 +1,4 @@ -import { setLang } from '../index'; +import setLang from '../lang'; const lang = { i: { @@ -100,6 +100,6 @@ const lang = { } }; -setLang(lang.i.locale, lang); +setLang(lang); export default lang; \ No newline at end of file -- libgit2 0.21.4