Skip to content

Commit

Permalink
⚠️ deprecated(options): remove Vue.use options
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed May 8, 2016
1 parent 3ae04b7 commit d87b59b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 24 deletions.
21 changes: 2 additions & 19 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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)
Expand All @@ -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
8 changes: 8 additions & 0 deletions test/specs/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
6 changes: 1 addition & 5 deletions test/specs/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import Vue from 'vue'
import locales from './fixture/locales'
import plugin from '../../src/index'
import 'babel-polyfill'

require('./path')
require('./format')
require('./compare')

Vue.use(plugin, {
lang: 'en',
locales: locales
})
Vue.use(plugin)

require('./i18n')
require('./asset')

0 comments on commit d87b59b

Please sign in to comment.