Skip to content
Snippets Groups Projects
Commit 8ca5f785 authored by Kocher, Manuel's avatar Kocher, Manuel
Browse files

Move i18n.t override from debug mode to normal frontend and change it from error to warning

parent af36f13c
No related branches found
No related tags found
No related merge requests found
......@@ -125,19 +125,16 @@ export function createInstance(languages, lng, fallback, namespace) {
i18n.init(options);
console.assert(i18n.isInitialized);
// if debug mode is activated, override i18n.t() to print errors if keys are missing
if (window.location.hash.includes('debug')) {
// override i18n.t() to print warnings if keys are missing
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!");
console.warn("Translation warning: Default key " + keys + " does not exist!");
}
return translate(keys, options);
};
}
return i18n;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment