chore: 🤖 add warning of existing queue when id is not found

This commit is contained in:
Christian Kaisermann 2019-11-21 23:32:24 -03:00
parent 49e9562890
commit 5f3595013e

View File

@ -2,7 +2,14 @@ import { derived } from 'svelte/store'
import { Formatter, MessageObject } from '../types' import { Formatter, MessageObject } from '../types'
import { lookupMessage } from '../includes/lookup' import { lookupMessage } from '../includes/lookup'
import { getLocalesFrom, capital, upper, lower, title } from '../includes/utils' import { hasLocaleQueue } from '../includes/loaderQueue'
import {
getAllFallbackLocales,
capital,
upper,
lower,
title,
} from '../includes/utils'
import { import {
getMessageFormatter, getMessageFormatter,
getTimeFormatter, getTimeFormatter,
@ -31,10 +38,15 @@ const formatMessage: Formatter = (id, options = {}) => {
if (!message) { if (!message) {
console.warn( console.warn(
`[svelte-i18n] The message "${id}" was not found in "${getLocalesFrom( `[svelte-i18n] The message "${id}" was not found in "${getAllFallbackLocales(
locale locale
).join('", "')}".` ).join('", "')}". ${
hasLocaleQueue(getCurrentLocale())
? `\n\nNote: there are at least one loader still registered to this locale that wasn't executed.`
: ''
}`
) )
return defaultValue || id return defaultValue || id
} }