Skip to content

Commit

Permalink
Improve performance of mergeLocaleMessage (#1099) (#1101)
Browse files Browse the repository at this point in the history
Co-authored-by: ericlee <ericlee@openrice.com>
  • Loading branch information
cslee and ericlee committed Jan 16, 2021
1 parent b417f85 commit 7d2e881
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,12 @@ export default class VueI18n {
if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') {
this._checkLocaleMessage(locale, this._warnHtmlInMessage, message)
}
this._vm.$set(this._vm.messages, locale, merge({}, this._vm.messages[locale] || {}, message))
this._vm.$set(this._vm.messages, locale, merge(
typeof this._vm.messages[locale] !== 'undefined' && Object.keys(this._vm.messages[locale]).length
? this._vm.messages[locale]
: {},
message
))
}
getDateTimeFormat (locale: Locale): DateTimeFormat {
Expand Down

0 comments on commit 7d2e881

Please sign in to comment.