Fixing issues with i18n stuff:

- Make gettext stuff draw-time. so switching between languages
  can happens without restart now.
- Added option to translate visible interface (menus, buttons, labels)
  and tooltips. Now it's possible to have english UI and localized tooltips.
- Clean-up sources, do not use gettext stuff for things which can be
  collected with RNA.
- Fix issues with windows 64bit and ru_RU locale on my desktop
  (it was codepage issue).
- Added operator "Get Messages" which generates new text block with
  with all strings collected from RNA.
- Changed script for updating blender.pot so now it appends
  messages collected from rna to automatically gathered messages.
  To update .pot you have to re-generate messages.txt using "Get Messages"
  operator and then run update_pot script.
- Clean up old translation stuff which wasn't used and most probably
  wouldn't be used.
- Return back "International Fonts" option, so if it's disabled, no
  gettext lookups happens on draw.
- Merged read_homefile function back. No need in splitting it.

TODO:
- Custom fonts and font size.
  Current font isn't nice at least for russian locale, it's
  difficult to read it.
- Put references to messages.txt so gettext can merge translation when
  name/description of some property changes.
This commit is contained in:
2011-09-15 13:20:18 +00:00
parent 30293dc2ca
commit 0eda51f2ea
236 changed files with 11166 additions and 6009 deletions

View File

@@ -17,6 +17,9 @@ defs = []
if is_debug:
defs.append('_DEBUG')
if env['WITH_BF_INTERNATIONAL']:
defs.append('INTERNATIONAL')
sources = env.Glob('generic/*.c')
env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [363,165]) # ketsji is 360

View File

@@ -48,5 +48,8 @@ set(SRC
py_capi_utils.h
)
if(WITH_INTERNATIONAL)
add_definitions(-DINTERNATIONAL)
endif()
blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}")

View File

@@ -34,6 +34,9 @@
#include "BLI_utildefines.h"
#ifdef INTERNATIONAL
#include "DNA_userdef_types.h" /* is it bad level? */
#endif
PyDoc_STRVAR(py_blf_position_doc,
@@ -367,6 +370,7 @@ static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
return PyLong_FromLong(BLF_load(filename));
}
#ifdef INTERNATIONAL
PyDoc_STRVAR(py_blf_gettext_doc,
".. function:: gettext(msgid)\n"
"\n"
@@ -380,9 +384,17 @@ PyDoc_STRVAR(py_blf_gettext_doc,
static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *args)
{
char* msgid;
const char *text;
if (!PyArg_ParseTuple(args, "s:blf.gettext", &msgid))
return NULL;
return PyUnicode_FromString( BLF_gettext( msgid ) );
if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE))
text = BLF_gettext( msgid );
else
text = msgid;
return PyUnicode_FromString( text );
}
PyDoc_STRVAR(py_blf_fake_gettext_doc,
@@ -403,6 +415,7 @@ static PyObject *py_blf_fake_gettext(PyObject *UNUSED(self), PyObject *args)
return PyUnicode_FromString( msgid );
}
#endif
/*----------------------------MODULE INIT-------------------------*/
static PyMethodDef BLF_methods[] = {
@@ -419,8 +432,10 @@ static PyMethodDef BLF_methods[] = {
{"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc},
{"size", (PyCFunction) py_blf_size, METH_VARARGS, py_blf_size_doc},
{"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc},
#ifdef INTERNATIONAL
{"gettext", (PyCFunction) py_blf_gettext, METH_VARARGS, py_blf_gettext_doc},
{"fake_gettext", (PyCFunction) py_blf_fake_gettext, METH_VARARGS, py_blf_fake_gettext_doc},
#endif
{NULL, NULL, 0, NULL}
};