summaryrefslogtreecommitdiff
path: root/webhelper
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2013-09-10 17:43:25 -0700
committerPhilip Chimento <philip@endlessm.com>2013-09-16 10:30:42 -0700
commite4048bffd4153f7d7bd978f5779caaec8e76a069 (patch)
treed1cbcae017c6a05a2bccb5ae1a85f76c33376e9b /webhelper
parente05a96375c7e6f26af836bd7e19bf99014a1e7cf (diff)
Do translation with webhelper
Previously, the translation was such that it did a dummy translation, italicizing the text to be translated. Now it looks for a translationFunction property on the app object, and calls that on the text. [endlessm/eos-sdk#290]
Diffstat (limited to 'webhelper')
-rw-r--r--webhelper/webhelper.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/webhelper/webhelper.js b/webhelper/webhelper.js
index 7ec17a6..ccce9e7 100644
--- a/webhelper/webhelper.js
+++ b/webhelper/webhelper.js
@@ -78,8 +78,11 @@ const Application = new Lang.Class({
// WebKit.DOMNode
let element = translatable.item(i);
- // TODO here is where we would do the translation
- element.inner_html = '<i>' + element.inner_text + '</i>';
+ // Translate the text
+ if(typeof this._translationFunction !== 'function')
+ throw new Error("No suitable translation function was found. " +
+ "Did you forget to set '_translationFunction' on your app?");
+ element.inner_html = this._translationFunction(element.inner_text);
}
}
});