Trace-log stacktrace of translations without key

c6a2b4e429006fad555528484a4abeb5509a1a7f

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +4 -0Showing whitespace changes
public/scripts/i18n.js+4 -0
@@ -100,6 +100,10 @@ export function t(strings, ...values) {
100100 */
101101export function translate(text, key = null) {
102102 const translationKey = key || text;
103+ if (translationKey === null || translationKey === undefined) {
104+ console.trace('WARN: No translation key provided');
105+ return '';
106+ }
103107 if (trackMissingDynamicTranslate && localeData && !Object.hasOwn(localeData, translationKey) && !trackMissingDynamicTranslate.includes(translationKey)) {
104108 trackMissingDynamicTranslate.push(translationKey);
105109 }