mirror of
https://github.com/cupcakearmy/svelte-i18n.git
synced 2024-09-28 15:14:45 +02:00
refactor: 💡 prevent null lookups from being cached
This commit is contained in:
parent
6573f51e9b
commit
a1dc268654
@ -8,6 +8,7 @@ import { getGenericLocaleFrom } from './utils'
|
|||||||
const lookupCache: Record<string, Record<string, string>> = {}
|
const lookupCache: Record<string, Record<string, string>> = {}
|
||||||
|
|
||||||
const addToCache = (path: string, locale: string, message: string) => {
|
const addToCache = (path: string, locale: string, message: string) => {
|
||||||
|
if (!message) return message
|
||||||
if (!(locale in lookupCache)) lookupCache[locale] = {}
|
if (!(locale in lookupCache)) lookupCache[locale] = {}
|
||||||
if (!(path in lookupCache[locale])) lookupCache[locale][path] = message
|
if (!(path in lookupCache[locale])) lookupCache[locale][path] = message
|
||||||
return message
|
return message
|
||||||
|
Loading…
Reference in New Issue
Block a user