From 5f3595013eacd63365623cacc220c1eb80c0e939 Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Thu, 21 Nov 2019 23:32:24 -0300 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20warning=20of=20ex?= =?UTF-8?q?isting=20queue=20when=20id=20is=20not=20found?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/stores/format.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/client/stores/format.ts b/src/client/stores/format.ts index 3ae5c60..cf86055 100644 --- a/src/client/stores/format.ts +++ b/src/client/stores/format.ts @@ -2,7 +2,14 @@ import { derived } from 'svelte/store' import { Formatter, MessageObject } from '../types' 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 { getMessageFormatter, getTimeFormatter, @@ -31,10 +38,15 @@ const formatMessage: Formatter = (id, options = {}) => { if (!message) { console.warn( - `[svelte-i18n] The message "${id}" was not found in "${getLocalesFrom( + `[svelte-i18n] The message "${id}" was not found in "${getAllFallbackLocales( 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 }