Improve backwards compatibility in WoltLab/WCF/Language
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Jul 2016 11:51:15 +0000 (13:51 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Jul 2016 11:51:49 +0000 (13:51 +0200)
wcfsetup/install/files/js/WoltLab/WCF/Language.js

index 3b3a3ad7a18813a24e082b2bc475cef043acfe6a..97e569c302f2ee64d037de587e0141c64e6707ef 100644 (file)
@@ -57,7 +57,12 @@ define(['Dictionary', './Template'], function(Dictionary, Template) {
                        
                        if (typeof value === 'string') {
                                // lazily convert to WCF.Template
-                               _languageItems.set(key, new Template(value));
+                               try {
+                                       _languageItems.set(key, new Template(value));
+                               }
+                               catch (e) {
+                                       _languageItems.set(key, new Template('{literal}' + value.replace(/\{\/literal\}/g, '{/literal}{ldelim}/literal}{literal}') + '{/literal}'));
+                               }
                                value = _languageItems.get(key);
                        }