From d87b59bbb1f922d8b21596fc5b1df853f77d95a8 Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Sat, 7 May 2016 23:21:25 +0900 Subject: [PATCH] :warning: deprecated(options): remove Vue.use options --- src/index.js | 21 ++------------------- test/specs/i18n.js | 8 ++++++++ test/specs/index.js | 6 +----- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/index.js b/src/index.js index 02d1c98e0..bf034d137 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -import util, { warn, empty, each } from './util' +import util, { warn } from './util' import path from './path' import compare from './compare' import Asset from './asset' @@ -30,21 +30,12 @@ function plugin (Vue, opts = {}) { return } - if (process.env.NODE_ENV !== 'production' && opts.lang) { - warn('`options.lang` will be deprecated in vue-i18n 3.1 later.') - } - let lang = opts.lang || 'en' - - if (process.env.NODE_ENV !== 'production' && opts.locales) { - warn('`options.locales` will be deprecated in vue-i18n 3.1 later.') - } - let locales = opts.locales || {} + let lang = 'en' path.Vue = util.Vue = Vue setupLangVM(Vue, lang) Asset(Vue) - setupLocale(Vue, locales) Override(Vue, langVM) Config(Vue, langVM) @@ -60,14 +51,6 @@ function setupLangVM (Vue, lang) { Vue.config.silent = silent } -function setupLocale (Vue, locales) { - if (!empty(locales)) { - each(locales, (locale, lang) => { - Vue.locale(lang, locale) - }) - } -} - plugin.version = '3.0.1' export default plugin diff --git a/test/specs/i18n.js b/test/specs/i18n.js index e74fbbeae..6b3714c45 100644 --- a/test/specs/i18n.js +++ b/test/specs/i18n.js @@ -4,6 +4,14 @@ import locales from './fixture/locales' describe('i18n', () => { + before((done) => { + Object.keys(locales).forEach((lang) => { + Vue.locale(lang, locales[lang]) + }) + Vue.config.lang = 'en' + Vue.nextTick(done) + }) + describe('Vue.t', () => { describe('en language locale', () => { it('should translate an english', () => { diff --git a/test/specs/index.js b/test/specs/index.js index f4c4be7dc..59fb52a3d 100644 --- a/test/specs/index.js +++ b/test/specs/index.js @@ -1,5 +1,4 @@ import Vue from 'vue' -import locales from './fixture/locales' import plugin from '../../src/index' import 'babel-polyfill' @@ -7,10 +6,7 @@ require('./path') require('./format') require('./compare') -Vue.use(plugin, { - lang: 'en', - locales: locales -}) +Vue.use(plugin) require('./i18n') require('./asset')