diff --git a/src/client/index.ts b/src/client/index.ts index 453cbff..2d4a3b6 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -59,7 +59,13 @@ const formatMessage: Formatter = (id, options = {}) => { const message = lookupMessage(id, locale) if (!message) { - console.warn(`[svelte-i18n] The message "${id}" was not found in the locale "${locale}".`) + console.warn( + `[svelte-i18n] The message "${id}" was not found in "${locale + .split('-') + .map((_, i, arr) => arr.slice(0, i + 1).join('-')) + .reverse() + .join('", "')}".`, + ) if (defaultValue != null) return defaultValue return id } diff --git a/test/client/index.test.ts b/test/client/index.test.ts index d20a4dd..e872f95 100644 --- a/test/client/index.test.ts +++ b/test/client/index.test.ts @@ -137,8 +137,8 @@ describe('utilities', () => { }) it('should get the fallback locale', () => { - expect(getClientLocale({ navigator: false, fallback: 'pt' })).toBe('pt') - expect(getClientLocale({ hash: 'locale', fallback: 'pt' })).toBe('pt') + expect(getClientLocale({ navigator: false, default: 'pt' })).toBe('pt') + expect(getClientLocale({ hash: 'locale', default: 'pt' })).toBe('pt') }) })