Skip to content

Commit

Permalink
👕 refactor(index): preserveDirectiveContent property via getter/setter
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Feb 10, 2019
1 parent 421ac55 commit e6f1ccd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ export default class VueI18n {
_numberFormatters: Object
_path: I18nPath
_dataListeners: Array<any>
_preserveDirectiveContent: boolean
pluralizationRules: {
[lang: string]: (choice: number, choicesLength: number) => number
}
preserveDirectiveContent: boolean

constructor (options: I18nOptions = {}) {
// Auto install if it is not done yet and `window` has `Vue`.
Expand Down Expand Up @@ -97,11 +97,10 @@ export default class VueI18n {
this._numberFormatters = {}
this._path = new I18nPath()
this._dataListeners = []

this.pluralizationRules = options.pluralizationRules || {}
this.preserveDirectiveContent = options.preserveDirectiveContent === undefined
this._preserveDirectiveContent = options.preserveDirectiveContent === undefined
? false
: !!options.preserveDirectiveContent
this.pluralizationRules = options.pluralizationRules || {}

this._exist = (message: Object, key: Path): boolean => {
if (!message || !key) { return false }
Expand Down Expand Up @@ -191,6 +190,9 @@ export default class VueI18n {
get silentFallbackWarn (): boolean { return this._silentFallbackWarn }
set silentFallbackWarn (silent: boolean): void { this._silentFallbackWarn = silent }

get preserveDirectiveContent (): boolean { return this._preserveDirectiveContent }
set preserveDirectiveContent (preserve: boolean): void { this._preserveDirectiveContent = preserve }

_getMessages (): LocaleMessages { return this._vm.messages }
_getDateTimeFormats (): DateTimeFormats { return this._vm.dateTimeFormats }
_getNumberFormats (): NumberFormats { return this._vm.numberFormats }
Expand Down

0 comments on commit e6f1ccd

Please sign in to comment.