have blf.gettext even when internationalization is disabled (just passes through).
authorCampbell Barton <ideasman42@gmail.com>
Tue, 20 Sep 2011 15:11:17 +0000 (15:11 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 20 Sep 2011 15:11:17 +0000 (15:11 +0000)
source/blender/python/generic/blf_py_api.c

index abf5ee7badae7eb18438be57e7cece8265d400ab..87e4a301effb951cd4ac2b95098fd2a5f8793140 100644 (file)
@@ -371,7 +371,6 @@ 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"
@@ -384,6 +383,7 @@ PyDoc_STRVAR(py_blf_gettext_doc,
 );
 static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *value)
 {
+#ifdef INTERNATIONAL
        if ((U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE)) {
                const char *msgid= _PyUnicode_AsString(value);
                if(msgid == NULL) {
@@ -393,11 +393,12 @@ static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *value)
 
                return PyUnicode_FromString(BLF_gettext(msgid));
        }
-       else {
+       else
+#endif /* INTERNATIONAL */
+       {
                return Py_INCREF(value), value;
        }
 }
-#endif /* INTERNATIONAL */
 
 /*----------------------------MODULE INIT-------------------------*/
 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},
        {"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_O, py_blf_gettext_doc},
-#endif
        {NULL, NULL, 0, NULL}
 };