have blf.gettext even when internationalization is disabled (just passes through).
This commit is contained in:
@@ -371,7 +371,6 @@ static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
|
|||||||
return PyLong_FromLong(BLF_load(filename));
|
return PyLong_FromLong(BLF_load(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef INTERNATIONAL
|
|
||||||
PyDoc_STRVAR(py_blf_gettext_doc,
|
PyDoc_STRVAR(py_blf_gettext_doc,
|
||||||
".. function:: gettext(msgid)\n"
|
".. function:: gettext(msgid)\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -384,6 +383,7 @@ PyDoc_STRVAR(py_blf_gettext_doc,
|
|||||||
);
|
);
|
||||||
static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *value)
|
static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *value)
|
||||||
{
|
{
|
||||||
|
#ifdef INTERNATIONAL
|
||||||
if ((U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE)) {
|
if ((U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE)) {
|
||||||
const char *msgid= _PyUnicode_AsString(value);
|
const char *msgid= _PyUnicode_AsString(value);
|
||||||
if(msgid == NULL) {
|
if(msgid == NULL) {
|
||||||
@@ -393,11 +393,12 @@ static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *value)
|
|||||||
|
|
||||||
return PyUnicode_FromString(BLF_gettext(msgid));
|
return PyUnicode_FromString(BLF_gettext(msgid));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
#endif /* INTERNATIONAL */
|
||||||
|
{
|
||||||
return Py_INCREF(value), value;
|
return Py_INCREF(value), value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* INTERNATIONAL */
|
|
||||||
|
|
||||||
/*----------------------------MODULE INIT-------------------------*/
|
/*----------------------------MODULE INIT-------------------------*/
|
||||||
static PyMethodDef BLF_methods[] = {
|
static PyMethodDef BLF_methods[] = {
|
||||||
@@ -414,9 +415,7 @@ static PyMethodDef BLF_methods[] = {
|
|||||||
{"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc},
|
{"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},
|
{"size", (PyCFunction) py_blf_size, METH_VARARGS, py_blf_size_doc},
|
||||||
{"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc},
|
{"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc},
|
||||||
#ifdef INTERNATIONAL
|
|
||||||
{"gettext", (PyCFunction) py_blf_gettext, METH_O, py_blf_gettext_doc},
|
{"gettext", (PyCFunction) py_blf_gettext, METH_O, py_blf_gettext_doc},
|
||||||
#endif
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user