[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56801] trunk/blender: Moved main part of bpy.app.translations doc out of C code, as suggested by Campell, thx.

Bastien Montagne montagne29 at wanadoo.fr
Tue May 14 20:16:38 CEST 2013


Revision: 56801
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56801
Author:   mont29
Date:     2013-05-14 18:16:37 +0000 (Tue, 14 May 2013)
Log Message:
-----------
Moved main part of bpy.app.translations doc out of C code, as suggested by Campell, thx.

Modified Paths:
--------------
    trunk/blender/source/blender/python/intern/bpy_app_translations.c

Added Paths:
-----------
    trunk/blender/doc/python_api/examples/bpy.app.translations.py

Added: trunk/blender/doc/python_api/examples/bpy.app.translations.py
===================================================================
--- trunk/blender/doc/python_api/examples/bpy.app.translations.py	                        (rev 0)
+++ trunk/blender/doc/python_api/examples/bpy.app.translations.py	2013-05-14 18:16:37 UTC (rev 56801)
@@ -0,0 +1,33 @@
+"""
+Intro
+-----
+
+.. warning::
+   Most of this object should only be useful if you actually manipulate i18n stuff from Python.
+   If you are a regular addon, you should only bother about :const:`contexts` member, 
+   and the :func:`register`/:func:`unregister` functions! The :func:`pgettext` family of functions
+   should only be used in rare, specific cases (like e.g. complex "composited" UI strings...).
+
+| To add translations to your python script, you must define a dictionary formatted like that:
+|    ``{locale: {msg_key: msg_translation, ...}, ...}``
+| where:
+
+* locale is either a lang iso code (e.g. ``fr``), a lang+country code (e.g. ``pt_BR``),
+  a lang+variant code (e.g. ``sr at latin``), or a full code (e.g. ``uz_UZ at cyrilic``).
+* msg_key is a tuple (context, org message) - use, as much as possible, the predefined :const:`contexts`.
+* msg_translation is the translated message in given language!
+
+Then, call ``bpy.app.translations.register(__name__, your_dict)`` in your ``register()`` function, and \n"
+``bpy.app.translations.unregister(__name__)`` in your ``unregister()`` one.
+
+The ``Manage UI translations`` addon has several functions to help you collect strings to translate, and
+generate the needed python code (the translation dictionary), as well as optional intermediary po files
+if you want some... See
+`How to Translate Blender <http://wiki.blender.org/index.php/Dev:Doc/Process/Translate_Blender>`_ and
+`Using i18n in Blender Code <http://wiki.blender.org/index.php/Dev:Source/Interface/Internationalization>`_
+for more info.
+
+Module References
+-----------------
+
+"""


Property changes on: trunk/blender/doc/python_api/examples/bpy.app.translations.py
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/blender/source/blender/python/intern/bpy_app_translations.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_app_translations.c	2013-05-14 16:22:53 UTC (rev 56800)
+++ trunk/blender/source/blender/python/intern/bpy_app_translations.c	2013-05-14 18:16:37 UTC (rev 56801)
@@ -705,36 +705,9 @@
 }
 
 PyDoc_STRVAR(app_translations_doc,
-"Intro\n"
-"-----\n"
-"\n"
 "This object contains some data/methods regarding internationalization in Blender, and allows every py script\n"
 "to feature translations for its own UI messages.\n"
 "\n"
-".. warning::\n"
-"   Most of this object should only be useful if you actually manipulate i18n stuff from Python.\n"
-"   If you are a regular addon, you should only bother about :const:`contexts` member, \n"
-"   and the :func:`register`/:func:`unregister` functions!\n"
-"\n"
-"| To add translations to your python script, you must define a dictionary formatted like that:\n"
-"|    ``{locale: {msg_key: msg_translation, ...}, ...}``\n"
-"| where:\n"
-"\n"
-"* locale is either a lang iso code (e.g. ``fr``), a lang+country code (e.g. ``pt_BR``),\n"
-"  a lang+variant code (e.g. ``sr at latin``), or a full code (e.g. ``uz_UZ at cyrilic``).\n"
-"* msg_key is a tuple (context, org message) - use, as much as possible, the predefined :const:`contexts`.\n"
-"* msg_translation is the translated message in given language!\n"
-"\n"
-"Then, call ``bpy.app.translations.register(__name__, your_dict)`` in your ``register()`` function, and \n"
-"``bpy.app.translations.unregister(__name__)`` in your ``unregister()`` one.\n"
-"\n"
-"``bl_i18n_utils`` module has several functions to help you collect strings to translate, and generate the needed\n"
-"python code (the translation dictionary), as well as optional intermediary po files if you want some...\n"
-"See its documentation for more details.\n"
-"\n"
-"Module References\n"
-"-----------------\n"
-"\n"
 );
 static PyTypeObject BlenderAppTranslationsType = {
 	PyVarObject_HEAD_INIT(NULL, 0)




More information about the Bf-blender-cvs mailing list