summaryrefslogtreecommitdiff
path: root/js/codeq/hint.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/codeq/hint.js')
-rw-r--r--js/codeq/hint.js20
1 files changed, 3 insertions, 17 deletions
diff --git a/js/codeq/hint.js b/js/codeq/hint.js
index 05b9d2a..5b2f66e 100644
--- a/js/codeq/hint.js
+++ b/js/codeq/hint.js
@@ -38,7 +38,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
hintCommonTr = commonDef.hint,
planDef = problemDef.plan,
templatePath = [problemDef.language, problemDef.group, problemDef.problem],
- templateName = templatePath.join('/'),
guiDict = codeq.tr.getDictionary('gui'),
btnMoreTranslations = guiDict['btn_more'] || {}, // get the default translations for the "more..." button
@@ -65,19 +64,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
return result;
},
- processTemplate = function (template, args) {
- var fn = codeq.templator(template, templatePath, templateName);
- return fn(args);
-/* if (!args)
- return template;
- return template.replace(/\[%=(\w+)%\]/g, function(match, name) {
- return args[name].toString()
- .replace(/&/g, '&amp')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;');
- });*/
- },
-
prepareStaticHintContent = function (hintContent, indices, hintId) {
var content = {},
langs = codeq.availableLangs,
@@ -209,11 +195,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
try {
msg = content[lang][hintIndex];
if (typeof msg === 'string') {
- trContent[lang] = processTemplate(msg, args);
+ trContent[lang] = codeq.template.process(msg, templatePath, args);
trButton[lang] = btnMoreTranslations[lang] || 'More...';
}
else {
- trContent[lang] = processTemplate(msg.message, args);
+ trContent[lang] = codeq.template.process(msg.message, templatePath, args);
trButton[lang] = msg.linkText;
}
}
@@ -282,7 +268,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
lang = langs[i];
content = template[lang];
if (typeof content === 'string') {
- translations[lang] = processTemplate(content, args);
+ translations[lang] = codeq.template.process(content, templatePath, args);
}
else {
translations[lang] = 'No translation in ' + lang + ' available for ' + type + ' hint ' + serverHint.id;