Skip to content

Commit 537ada7

Browse files
author
Esben Anker-Møller
committed
Don't throw an error when missing a translation - just log
If an error is thrown the whole program breaks. This combined with the fact that several keys are missing across different translations makes it a fairly inconvenient issue. With this in place the program will finish with logs warning about the missing keys.
1 parent e858f21 commit 537ada7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

HTMLCS.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ _global.HTMLCS = new function()
8484
var translations = _global.translation[this.lang];
8585

8686
if (!translations) {
87-
throw new Error ('Missing translations for language ' + this.lang);
87+
console.error('Missing translations for language ' + this.lang);
88+
return '';
8889
}
8990

9091
var translation = translations[text];
9192

9293
if (!translation) {
93-
throw new Error('Translation for "' + text + '" does not exist in current language ' + this.lang);
94+
console.error('Translation for "' + text + '" does not exist in current language ' + this.lang);
95+
return '';
9496
}
9597

9698
return translation;

0 commit comments

Comments
 (0)