Skip to content

Commit

Permalink
💥 breaking: change fallbackRoot and sync option default true value
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Mar 18, 2017
1 parent a6b7e37 commit 0890b44
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class VueI18n {
_vm: any
_formatter: Formatter
_root: ?I18n
_sync: ?boolean
_sync: boolean
_fallbackRoot: boolean
_fallbackLocale: Locale
_missing: ?MissingHandler
Expand All @@ -29,8 +29,8 @@ export default class VueI18n {
this._formatter = options.formatter || new BaseFormatter()
this._missing = options.missing
this._root = options.root || null
this._sync = options.sync || false
this._fallbackRoot = options.fallbackRoot || false
this._sync = options.sync === undefined ? true : !!options.sync
this._fallbackRoot = options.fallbackRoot === undefined ? true : !!options.fallbackRoot

this._exist = (message: Object, key: Path): boolean => {
if (!message || !key) { return false }
Expand Down
2 changes: 1 addition & 1 deletion src/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default {
}
this.$i18n = new VueI18n(options.i18n)
defineComputed(this, options)
if (options.i18n.sync) {
if (options.i18n.sync === undefined || !!options.i18n.sync) {
this._localeWatcher = this.$i18n.watchLocale()
}
} else {
Expand Down
3 changes: 1 addition & 2 deletions test/unit/component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('component translation', () => {
child1: { // translation with component
i18n: {
locale: 'en',
fallbackRoot: true,
sync: false,
messages: {
en: { who: 'child1' },
ja: { who: '子1' }
Expand All @@ -49,7 +49,6 @@ describe('component translation', () => {
components: {
'sub-child2': {
i18n: {
sync: true,
messages: {
en: { who: 'sub-child2' },
ja: { who: 'サブの子2' }
Expand Down

0 comments on commit 0890b44

Please sign in to comment.