From 14f24f2725771dcea0793de146abc9b86ea88789 Mon Sep 17 00:00:00 2001 From: Jakub Havelka Date: Wed, 27 Jan 2021 18:03:18 +0100 Subject: [PATCH] fix: message when translations are missing (#964) --- packages/cli/src/api/catalog.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/cli/src/api/catalog.ts b/packages/cli/src/api/catalog.ts index 40b312af2..45f94c3e8 100644 --- a/packages/cli/src/api/catalog.ts +++ b/packages/cli/src/api/catalog.ts @@ -262,6 +262,13 @@ export class Catalog { const getTranslation = (locale) => { const configLocales = this.config.locales.join('", "') + + if (!catalogs[locale].hasOwnProperty(key)) { + console.error(`Message with key ${key} is missing in locale ${locale}`); + return null; + } + + if (catalogs[locale]) { return catalogs[locale][key].translation }