diff options
author | Aleš Smodiš <aless@guru.si> | 2015-09-28 18:44:48 +0200 |
---|---|---|
committer | Aleš Smodiš <aless@guru.si> | 2015-09-28 18:44:48 +0200 |
commit | 7dab4d3640b7b37c407eea111eda1fc0b71adbda (patch) | |
tree | f6d422f294d796706634de43826bce117fef409a /js/codeq/hint.js | |
parent | 1e0c68482267f7e7393d2cde5042fcd863b8e23b (diff) |
Implement in-structure GUI translation for python and problem editing screens.
Hints are not yet covered.
Diffstat (limited to 'js/codeq/hint.js')
-rw-r--r-- | js/codeq/hint.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/js/codeq/hint.js b/js/codeq/hint.js index e1c7a6b..1b97afc 100644 --- a/js/codeq/hint.js +++ b/js/codeq/hint.js @@ -7,10 +7,11 @@ var firstCharacterPos = {'line': 0, 'ch': 0}, sel_no_scroll = {'scroll': false}; - codeq.makeHinter = function (jqHints, jqEditor, editor, hintDefs, planDef) { + codeq.makeHinter = function (jqHints, jqEditor, editor, trNamespace, hintDefsA, commonHintDefsA, planDef) { var hintCounter = 0, // for generating unique class-names hintCleaners = [], planIdx = 0, + dictionary = [], clearHints = function () { var i; @@ -130,6 +131,25 @@ } }; + codeq.tr.registerDictionary(trNamespace, dictionary); + + // TODO: below is a temporary code to bridge the old implementation with the new data format + if (planDef.sl) planDef = planDef.sl; + else planDef = planDef.en || []; + var hintDefs = {}, t1, t2, k; + if (hintDefsA.sl) t1 = hintDefsA.sl; + else t1 = hintDefsA.en || {}; + if (commonHintDefsA.sl) t2 = commonHintDefsA.sl; + else t2 = commonHintDefsA.en || {}; + for (k in t2) { + if (!t2.hasOwnProperty(k)) continue; + hintDefs[k] = t2[k]; + } + for (k in t1) { + if (!t1.hasOwnProperty(k)) continue; + hintDefs[k] = t1[k]; + } + return { /** Display the next "planning" hint and return whether there are * any more available. @@ -195,6 +215,7 @@ 'destroy': function () { clearHints(); + codeq.tr.unregisterDictionary(trNamespace); jqHints.empty(); jqHints = null; jqEditor = null; |