Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python/generic/blf_py_api.c')
-rw-r--r--source/blender/python/generic/blf_py_api.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 3cf0b0f1f27..7bc115f943c 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -367,6 +367,43 @@ static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
return PyLong_FromLong(BLF_load(filename));
}
+PyDoc_STRVAR(py_blf_gettext_doc,
+".. function:: gettext(msgid)\n"
+"\n"
+" Get a msg in local language.\n"
+"\n"
+" :arg msgid: the source string.\n"
+" :type msgid: string\n"
+" :return: the localized string.\n"
+" :rtype: string\n"
+);
+static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *args)
+{
+ char* msgid;
+ if (!PyArg_ParseTuple(args, "s:blf.gettext", &msgid))
+ return NULL;
+ return PyUnicode_FromString( BLF_gettext( msgid ) );
+}
+
+PyDoc_STRVAR(py_blf_fake_gettext_doc,
+".. function:: fake_gettext(msgid)\n"
+"\n"
+" Just tag the msgid.\n"
+"\n"
+" :arg msgid: the source string.\n"
+" :type msgid: string\n"
+" :return: the source string.\n"
+" :rtype: string\n"
+);
+static PyObject *py_blf_fake_gettext(PyObject *UNUSED(self), PyObject *args)
+{
+ const char* msgid;
+ if (!PyArg_ParseTuple(args, "s:blf.fake_gettext", &msgid))
+ return NULL;
+
+ return PyUnicode_FromString( msgid );
+}
+
/*----------------------------MODULE INIT-------------------------*/
static PyMethodDef BLF_methods[] = {
{"aspect", (PyCFunction) py_blf_aspect, METH_VARARGS, py_blf_aspect_doc},
@@ -382,6 +419,8 @@ 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},
+ {"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},
{NULL, NULL, 0, NULL}
};