diff --git a/FCNN.js b/FCNN.js index 19f1fef..077c2b9 100644 --- a/FCNN.js +++ b/FCNN.js @@ -49,7 +49,7 @@ function FCNN() { let sup_map = {'0': '⁰', '1': '¹', '2': '²', '3': '³', '4': '⁴', '5': '⁵', '6': '⁶', '7': '⁷', '8': '⁸', '9': '⁹'}; let sup = (s) => Array.prototype.map.call(s, (d) => (d in sup_map && sup_map[d]) || d).join(''); - let textFn = (layer_index, layer_width) => ((layer_index === 0 ? "Input" : (layer_index === architecture.length-1 ? "Output" : "Hidden")) + " Layer ∈ ℝ" + sup(layer_width.toString())); + let textFn = (layer_index, layer_width) => ((layer_index === 0 ? localize("Input Layer") : (layer_index === architecture.length-1 ? localize("Output Layer") : localize("Hidden Layer"))) + localize(" ∈ ℝ") + sup(layer_width.toString())); var nominal_text_size = 12; var textWidth = 70; diff --git a/util.js b/util.js index ad1f6af..b629819 100644 --- a/util.js +++ b/util.js @@ -17,3 +17,17 @@ Array.prototype.last = function() { return this[this.length - 1]; }; let flatten = (array) => array.reduce((flat, toFlatten) => (flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten)), []); +let localize = s => s; // for English +/** for German * / +let localize = function(s) { + var translations = { + "Input Layer": "Eingabeschicht", + "Output Layer": "Ausgabeschicht", + "Hidden Layer": "Innere Schicht" + }; + if (s in translations) + return translations[s]; + else + console.log("no translation for " + s); + return s; +}/**/