From e4048bffd4153f7d7bd978f5779caaec8e76a069 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 10 Sep 2013 17:43:25 -0700 Subject: 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] --- webhelper/webhelper.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'webhelper') 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 = '' + element.inner_text + ''; + // 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); } } }); -- cgit v1.2.3