changeset 2540:99ecf78cf7ed

adds docs for the usage of the i18n plugin
author sharky93 <rishabhr123@gmail.com>
date Mon, 23 Sep 2013 20:31:10 +0530
parents 1c873c0165f3
children 9569b293dae1
files docs/devel/development.rst
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/docs/devel/development.rst	Sun Sep 22 23:06:25 2013 +0530
+++ b/docs/devel/development.rst	Mon Sep 23 20:31:10 2013 +0530
@@ -155,7 +155,7 @@
 * blinker for signalling
 * pygments for syntax highlighting
 * for stores: filesystem, sqlite3, sqlalchemy, kyoto cabinet/tycoon, mongodb, memory
-* jquery javascript lib
+* jquery javascript lib, a simple jQuery i18n plugin `Plugin <https://github.com/recurser/jquery-i18n>`_
 * CKeditor, the GUI editor for (x)html
 * TWikiDraw, AnyWikiDraw, svgdraw drawing tools
 
@@ -273,6 +273,24 @@
 values it can use. In addition to this general environment, parameters can
 also be given directly to the render call.
 
+Internationalization in MoinMoin's JS
+-------------------------------------
+Any string which has to be translated and used in the JavaScript code, has to be defined 
+at ``MoinMoin/templates/dictionary.js``. This dictionary is loaded when the page loads and
+the translation for any string can be received by passing it as a parameter to the ``_`` function,
+also defined in the same file.
+
+For Example
+
+We add the following to ``i18n_dict`` in ``dictionary.js`` 
+    
+    ``"somestring"  : "{{  _("somestring") }}",``
+
+Now, the translated version of "somestring" can be accessed in the JavaScript code by
+
+    ``var a = _("somestring");``
+
+
 Testing
 =======