diff --git a/packages/common/i18next.js b/packages/common/i18next.js index 7fcd05b7ac2653ade85c392c542906c30da5b463..2ece798cf7d61423a3a995d6ebe8c2a16e6ef18c 100644 --- a/packages/common/i18next.js +++ b/packages/common/i18next.js @@ -125,16 +125,19 @@ export function createInstance(languages, lng, fallback, namespace) { i18n.init(options); console.assert(i18n.isInitialized); - const translate = i18n.t; - const that = i18n; - - i18n.t = function (keys, options) { - if (!that.exists(keys)) { - console.error("Error: Translation key " + keys + " does not exist!"); - } - - return translate(keys, options); - }; + // if debug mode is activated, override i18n.t() to print errors if keys are missing + if (window.location.hash.includes('debug')) { + const translate = i18n.t; + const that = i18n; + + i18n.t = function (keys, options) { + if (!that.exists(keys)) { + console.error("Error: Translation key " + keys + " does not exist!"); + } + + return translate(keys, options); + }; + } return i18n; }