Skip to content

Commit

Permalink
chore: 🤖 add warning of existing queue when id is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisermann committed Nov 22, 2019
1 parent 49e9562 commit 5f35950
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/client/stores/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 5f35950

Please sign in to comment.