2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * The Original Code is Copyright (C) 2011 Blender Foundation.
17 * All rights reserved.
25 #ifndef __BLT_TRANSLATION_H__
26 #define __BLT_TRANSLATION_H__
28 #include "BLI_utildefines.h" /* for bool type */
30 #define TEXT_DOMAIN_NAME "blender"
36 bool BLT_is_default_context(const char *msgctxt);
37 const char *BLT_pgettext(const char *msgctxt, const char *msgid);
40 bool BLT_translate(void);
41 bool BLT_translate_iface(void);
42 bool BLT_translate_tooltips(void);
43 bool BLT_translate_new_dataname(void);
44 const char *BLT_translate_do(const char *msgctxt, const char *msgid);
45 const char *BLT_translate_do_iface(const char *msgctxt, const char *msgid);
46 const char *BLT_translate_do_tooltip(const char *msgctxt, const char *msgid);
47 const char *BLT_translate_do_new_dataname(const char *msgctxt, const char *msgid);
49 bool BLT_lang_is_ime_supported(void);
51 /* The "translation-marker" macro. */
52 #define N_(msgid) msgid
53 #define CTX_N_(context, msgid) msgid
55 /* Those macros should be used everywhere in UI code. */
56 #ifdef WITH_INTERNATIONAL
57 /*# define _(msgid) BLT_gettext(msgid) */
58 # define IFACE_(msgid) BLT_translate_do_iface(NULL, msgid)
59 # define TIP_(msgid) BLT_translate_do_tooltip(NULL, msgid)
60 # define DATA_(msgid) BLT_translate_do_new_dataname(NULL, msgid)
61 # define CTX_IFACE_(context, msgid) BLT_translate_do_iface(context, msgid)
62 # define CTX_TIP_(context, msgid) BLT_translate_do_tooltip(context, msgid)
63 # define CTX_DATA_(context, msgid) BLT_translate_do_new_dataname(context, msgid)
65 /*# define _(msgid) msgid */
66 # define IFACE_(msgid) msgid
67 # define TIP_(msgid) msgid
68 # define DATA_(msgid) msgid
69 # define CTX_IFACE_(context, msgid) msgid
70 # define CTX_TIP_(context, msgid) msgid
71 # define CTX_DATA_(context, msgid) msgid
74 /* Helper macro, when we want to define a same msgid for multiple msgctxt...
75 * Does nothing in C, but is "parsed" by our i18n py tools.
76 * XXX Currently limited to at most 16 contexts at once
77 * (but you can call it several times with the same msgid, should you need more contexts!).
79 #define BLT_I18N_MSGID_MULTI_CTXT(msgid, ...)
81 /******************************************************************************
82 * All i18n contexts must be defined here.
83 * This is a nice way to be sure not to use a context twice for different
84 * things, and limit the number of existing contexts!
85 * WARNING! Contexts should not be longer than BKE_ST_MAXNAME - 1!
88 /* Default, void context.
89 * WARNING! The "" context is not the same as no (NULL) context at mo/boost::locale level!
90 * NOTE: We translate BLT_I18NCONTEXT_DEFAULT as BLT_I18NCONTEXT_DEFAULT_BPY in Python, as we can't use "natural"
91 * None value in rna string properties... :/
92 * The void string "" is also interpreted as BLT_I18NCONTEXT_DEFAULT.
93 * For perf reason, we only use the first char to detect this context, so other contexts should never start
96 #define BLT_I18NCONTEXT_DEFAULT NULL
97 #define BLT_I18NCONTEXT_DEFAULT_BPYRNA "*"
99 /* Default context for operator names/labels. */
100 #define BLT_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
102 /* Context for events/keymaps (necessary, since those often use one or two letters,
103 * easy to get collisions with other areas...). */
104 #define BLT_I18NCONTEXT_UI_EVENTS "UI_Events_KeyMaps"
106 /* Mark the msgid applies to several elements (needed in some cases, as english adjectives have no plural mark :( ). */
107 #define BLT_I18NCONTEXT_PLURAL "Plural"
109 /* ID-types contexts. */
110 /* WARNING! Keep it in sync with idtypes in blenkernel/intern/idcode.c */
111 #define BLT_I18NCONTEXT_ID_ACTION "Action"
112 #define BLT_I18NCONTEXT_ID_ARMATURE "Armature"
113 #define BLT_I18NCONTEXT_ID_BRUSH "Brush"
114 #define BLT_I18NCONTEXT_ID_CAMERA "Camera"
115 #define BLT_I18NCONTEXT_ID_CACHEFILE "CacheFile"
116 #define BLT_I18NCONTEXT_ID_COLLECTION "Collection"
117 #define BLT_I18NCONTEXT_ID_CURVE "Curve"
118 #define BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE "FreestyleLineStyle"
119 #define BLT_I18NCONTEXT_ID_GPENCIL "GPencil"
120 #define BLT_I18NCONTEXT_ID_ID "ID"
121 #define BLT_I18NCONTEXT_ID_IMAGE "Image"
122 /*#define BLT_I18NCONTEXT_ID_IPO "Ipo"*/ /* Deprecated */
123 #define BLT_I18NCONTEXT_ID_SHAPEKEY "Key"
124 #define BLT_I18NCONTEXT_ID_LIGHT "Light"
125 #define BLT_I18NCONTEXT_ID_LIBRARY "Library"
126 #define BLT_I18NCONTEXT_ID_LATTICE "Lattice"
127 #define BLT_I18NCONTEXT_ID_MATERIAL "Material"
128 #define BLT_I18NCONTEXT_ID_METABALL "Metaball"
129 #define BLT_I18NCONTEXT_ID_MESH "Mesh"
130 #define BLT_I18NCONTEXT_ID_NODETREE "NodeTree"
131 #define BLT_I18NCONTEXT_ID_OBJECT "Object"
132 #define BLT_I18NCONTEXT_ID_PAINTCURVE "PaintCurve"
133 #define BLT_I18NCONTEXT_ID_PALETTE "Palette"
134 #define BLT_I18NCONTEXT_ID_PARTICLESETTINGS "ParticleSettings"
135 #define BLT_I18NCONTEXT_ID_LIGHTPROBE "LightProbe"
136 #define BLT_I18NCONTEXT_ID_SCENE "Scene"
137 #define BLT_I18NCONTEXT_ID_SCREEN "Screen"
138 #define BLT_I18NCONTEXT_ID_SEQUENCE "Sequence"
139 #define BLT_I18NCONTEXT_ID_SPEAKER "Speaker"
140 #define BLT_I18NCONTEXT_ID_SOUND "Sound"
141 #define BLT_I18NCONTEXT_ID_TEXTURE "Texture"
142 #define BLT_I18NCONTEXT_ID_TEXT "Text"
143 #define BLT_I18NCONTEXT_ID_VFONT "VFont"
144 #define BLT_I18NCONTEXT_ID_WORLD "World"
145 #define BLT_I18NCONTEXT_ID_WORKSPACE "WorkSpace"
146 #define BLT_I18NCONTEXT_ID_WINDOWMANAGER "WindowManager"
147 #define BLT_I18NCONTEXT_ID_MOVIECLIP "MovieClip"
148 #define BLT_I18NCONTEXT_ID_MASK "Mask"
150 /* Helper for bpy.app.i18n object... */
155 } BLT_i18n_contexts_descriptor;
157 #define BLT_I18NCONTEXTS_ITEM(ctxt_id, py_id) {#ctxt_id, py_id, ctxt_id}
159 #define BLT_I18NCONTEXTS_DESC { \
160 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_DEFAULT, "default_real"), \
161 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_DEFAULT_BPYRNA, "default"), \
162 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "operator_default"), \
163 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_UI_EVENTS, "ui_events_keymaps"), \
164 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_PLURAL, "plural"), \
165 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_ACTION, "id_action"), \
166 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_ARMATURE, "id_armature"), \
167 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_BRUSH, "id_brush"), \
168 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_CAMERA, "id_camera"), \
169 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_CACHEFILE, "id_cachefile"), \
170 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_COLLECTION, "id_collection"), \
171 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_CURVE, "id_curve"), \
172 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE, "id_fs_linestyle"), \
173 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_GPENCIL, "id_gpencil"), \
174 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_ID, "id_id"), \
175 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_IMAGE, "id_image"), \
176 /*BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_IPO, "id_ipo"),*/ \
177 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SHAPEKEY, "id_shapekey"), \
178 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_LIGHT, "id_light"), \
179 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_LIBRARY, "id_library"), \
180 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_LATTICE, "id_lattice"), \
181 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_MASK, "id_mask"), \
182 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_MATERIAL, "id_material"), \
183 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_METABALL, "id_metaball"), \
184 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_MESH, "id_mesh"), \
185 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_MOVIECLIP, "id_movieclip"), \
186 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_NODETREE, "id_nodetree"), \
187 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_OBJECT, "id_object"), \
188 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_PAINTCURVE, "id_paintcurve"), \
189 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_PALETTE, "id_palette"), \
190 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_PARTICLESETTINGS, "id_particlesettings"), \
191 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_LIGHTPROBE, "id_lightprobe"), \
192 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SCENE, "id_scene"), \
193 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SCREEN, "id_screen"), \
194 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SEQUENCE, "id_sequence"), \
195 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SPEAKER, "id_speaker"), \
196 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SOUND, "id_sound"), \
197 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_TEXTURE, "id_texture"), \
198 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_TEXT, "id_text"), \
199 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_VFONT, "id_vfont"), \
200 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_WORLD, "id_world"), \
201 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_WORKSPACE, "id_workspace"), \
202 BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "id_windowmanager"), \
210 #endif /* __BLT_TRANSLATION_H__ */