On 01/20/2013 05:29 PM, Bastien Montagne wrote:
> Revision: 53930
>
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53930
> Author: mont29
> Date: 2013-01-20 17:29:07 +0000 (Sun, 20 Jan 2013)
> Log Message:
> -----------
> Python i18n API. Many thanks to Campbell and Brecht for the reviews and
> suggestions!
>
> This commit adds:
> * A new bpy.app.translations module giving some info about
> locales/translation stuff (current active locale, all locales currently known
> by blender, all translation contexts currently defined, etc.).
>
Is there any reason this was added rather than just using pythons i18n
stuff?
I add translation to my (multiple python file) scripts in my primstar
addon with:
__init__.py
import os
import gettext
LOCALE_DIR = os.path.join(os.path.dirname(__file__), 'locale')
translator = gettext.translation('primstar', LOCALE_DIR, fallback=True)
_ = translator.gettext
---->8------
a_script.py
import bpy
from . import _
class ObjectBakeSculpt(bpy.types.Operator):
bl_idname = "object.sculpty_bake"
bl_label = _("Bake Sculpt Maps...")
---->8------ So here the idname is fixed string, label is translatable.
It's then normal po mo stuff for each supported language..
#! /bin/bash
xgettext -LPython -oaddons/primstar/locale/primstar.pot
--from-code=UTF-8 --copyright-holder='Domino Marama'
--package-name=Primstar --package-version=2 addons/primstar/*.py
msginit --no-translator -o po/en_GB.po -i
addons/primstar/locale/primstar.pot
msgfmt -o addons/primstar/locale/en/LC_MESSAGES/primstar.mo po/en_GB.po
So my translators can use all their usual tools for editing the po files..
Just wondering why this commit was added to do something that's already
possible...
Cheers,
Domino
_______________________________________________
Bf-committers mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-committers