From 1ab00ac804530eec3ba91608f207ea8af03c35a2 Mon Sep 17 00:00:00 2001 From: Paul-Vincent Roll Date: Sun, 24 Apr 2016 23:14:24 +0200 Subject: [PATCH] Moved this.translate() to the instance methods --- modules/README.md | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/modules/README.md b/modules/README.md index 9d6be2cd..b2caa2af 100644 --- a/modules/README.md +++ b/modules/README.md @@ -277,6 +277,25 @@ To show a module, you can call the `show(speed, callback)` method. You can call **Note 2:** If the show animation is hijacked (an other method calls show on the same module), the callback will not be called.
**Note 3:** If the dom is not yet created, the show method won't work. Wait for the `DOM_OBJECTS_CREATED` [notification](#notificationreceivednotification-payload-sender). +####`this.translate(identifier)` +***identifier* String** - Identifier of the string that should be translated. + +The Magic Mirror contains a convenience wrapper for `l18n`. You can use this to automatically serve different translations for your modules based on the user's `language` configuration. + +**Example:** +````javascript +this.translate("INFO") //Will return a translated string for the identifier INFO +```` + +**Example json file:** +````javascript +{ + "INFO": "Really important information!" +} +```` + +**Note:** Currently there is no fallback if a translation identifier does not exist in one language. Right now you always have to add all identifier to all your translations even if they are not translated yet (see [#191](https://github.com/MichMich/MagicMirror/issues/191)). + ## The Node Helper: node_helper.js @@ -464,23 +483,6 @@ Module.register("modulename",{ //... }); ```` -## MagicMirror Translation - -The Magic Mirror contains a convenience wrapper for `l18n`. You can use this to automatically serve different translations for your modules based on the user's `language` configuration. - -**Example:** -````javascript -this.translate("INFO") //Will return a translated string for the identifier INFO -```` - -**Example json file:** -````javascript -{ - "INFO": "Really important information!" -} -```` - -**Note:** Currently there is no fallback if a translation identifier does not exist in one language. Right now you always have to add all identifier to all your translations even if they are not translated yet (see [#191](https://github.com/MichMich/MagicMirror/issues/191)). ## MagicMirror Logger