Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use plain object instead of Map, which is not supported in IE9/10 #844

Merged
merged 1 commit into from
Apr 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/index.js
Expand Up @@ -41,7 +41,7 @@ export default class VueI18n {
_root: any
_sync: boolean
_fallbackRoot: boolean
_localeChainCache: Map<string, Array<Locale>>
_localeChainCache: { [key: string]: Array<Locale>; }
_missing: ?MissingHandler
_exist: Function
_silentTranslationWarn: boolean | RegExp
Expand Down Expand Up @@ -237,7 +237,7 @@ export default class VueI18n {

get fallbackLocale (): Locale { return this._vm.fallbackLocale }
set fallbackLocale (locale: Locale): void {
this._localeChainCache = new Map()
this._localeChainCache = {}
this._vm.$set(this._vm, 'fallbackLocale', locale)
}

Expand Down Expand Up @@ -500,10 +500,10 @@ export default class VueI18n {
if (start === '') { return [] }

if (!this._localeChainCache) {
this._localeChainCache = new Map()
this._localeChainCache = {}
}

let chain = this._localeChainCache.get(start)
let chain = this._localeChainCache[start]
if (!chain) {
if (!fallbackLocale) {
fallbackLocale = this.fallbackLocale
Expand Down Expand Up @@ -549,7 +549,7 @@ export default class VueI18n {
null
)
}
this._localeChainCache.set(start, chain)
this._localeChainCache[start] = chain
}
return chain
}
Expand Down