workaround for loopselect-slide (with multicut enabled) changing from vertex-select...
[blender-staging.git] / source / blender / blenfont / BLF_translation.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version. 
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2011 Blender Foundation.
19  * All rights reserved.
20  *
21  *
22  * Contributor(s): Blender Foundation,
23  *                 Sergey Sharybin
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  */
27
28 /** \file blender/blenfont/BLF_translation.h
29  *  \ingroup blf
30  */
31
32
33 #ifndef __BLF_TRANSLATION_H__
34 #define __BLF_TRANSLATION_H__
35
36 #include "BLI_utildefines.h"  /* for bool type */
37
38 #define TEXT_DOMAIN_NAME "blender"
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /* blf_lang.c */
45
46 /* Search the path directory to the locale files, this try all
47  * the case for Linux, Win and Mac.
48  * Also dynamically builds locales and locales' menu from "languages" text file.
49  */
50 void BLF_lang_init(void);
51
52 /* Free languages and locales_menu arrays created by BLF_lang_init. */
53 void BLF_lang_free(void);
54
55 /* Set the current locale. */
56 void BLF_lang_set(const char *);
57 /* Get the current locale ([partial] ISO code, e.g. es_ES). */
58 const char *BLF_lang_get(void);
59
60 /* Get locale's elements (if relevant pointer is not NULL and element actually exists, e.g. if there is no variant,
61  * *variant and *language_variant will always be NULL).
62  * Non-null elements are always MEM_mallocN'ed, it's the caller's responsibility to free them.
63  * NOTE: Always available, even in non-WITH_INTERNATIONAL builds.
64  */
65 void BLF_locale_explode(const char *locale, char **language, char **country, char **variant,
66                         char **language_country, char **language_variant);
67
68 /* Get EnumPropertyItem's for translations menu. */
69 struct EnumPropertyItem *BLF_RNA_lang_enum_properties(void);
70
71 /* blf_translation.c  */
72
73 unsigned char *BLF_get_unifont(int *unifont_size);
74 void BLF_free_unifont(void);
75 unsigned char *BLF_get_unifont_mono(int *unifont_size);
76 void BLF_free_unifont_mono(void);
77
78 bool BLF_is_default_context(const char *msgctxt);
79 const char *BLF_pgettext(const char *msgctxt, const char *msgid);
80
81 /* translation */
82 bool BLF_translate_iface(void);
83 bool BLF_translate_tooltips(void);
84 bool BLF_translate_new_dataname(void);
85 const char *BLF_translate_do_iface(const char *msgctxt, const char *msgid);
86 const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
87 const char *BLF_translate_do_new_dataname(const char *msgctxt, const char *msgid);
88
89
90 /* The "translation-marker" macro. */
91 #define N_(msgid) msgid
92 #define CTX_N_(context, msgid) msgid
93
94 /* Those macros should be used everywhere in UI code. */
95 #ifdef WITH_INTERNATIONAL
96 /*#  define _(msgid) BLF_gettext(msgid) */
97 #  define IFACE_(msgid) BLF_translate_do_iface(NULL, msgid)
98 #  define TIP_(msgid) BLF_translate_do_tooltip(NULL, msgid)
99 #  define DATA_(msgid) BLF_translate_do_new_dataname(NULL, msgid)
100 #  define CTX_IFACE_(context, msgid) BLF_translate_do_iface(context, msgid)
101 #  define CTX_TIP_(context, msgid) BLF_translate_do_tooltip(context, msgid)
102 #  define CTX_DATA_(context, msgid) BLF_translate_do_new_dataname(context, msgid)
103 #else
104 /*#  define _(msgid) msgid */
105 #  define IFACE_(msgid) msgid
106 #  define TIP_(msgid)   msgid
107 #  define DATA_(msgid)  msgid
108 #  define CTX_IFACE_(context, msgid) msgid
109 #  define CTX_TIP_(context, msgid)   msgid
110 #  define CTX_DATA_(context, msgid)  msgid
111 #endif
112
113 /* Helper macro, when we want to define a same msgid for multiple msgctxt...
114  * Does nothing in C, but is "parsed" by our i18n py tools.
115  * XXX Currently limited to at most 16 contexts at once
116  *     (but you can call it several times with the same msgid, should you need more contexts!).
117  */
118 #define BLF_I18N_MSGID_MULTI_CTXT(msgid, ...)
119
120 /******************************************************************************
121  * All i18n contexts must be defined here.
122  * This is a nice way to be sure not to use a context twice for different
123  * things, and limit the number of existing contexts!
124  * WARNING! Contexts should not be longer than BKE_ST_MAXNAME - 1!
125  */
126
127 /* Default, void context.
128  * WARNING! The "" context is not the same as no (NULL) context at mo/boost::locale level!
129  * NOTE: We translate BLF_I18NCONTEXT_DEFAULT as BLF_I18NCONTEXT_DEFAULT_BPY in Python, as we can't use "natural"
130  *       None value in rna string properties... :/
131  *       The void string "" is also interpreted as BLF_I18NCONTEXT_DEFAULT.
132  *       For perf reason, we only use the first char to detect this context, so other contexts should never start
133  *       with the same char!
134  */
135 #define BLF_I18NCONTEXT_DEFAULT NULL
136 #define BLF_I18NCONTEXT_DEFAULT_BPYRNA "*"
137
138 /* Default context for operator names/labels. */
139 #define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
140
141 /* Mark the msgid applies to several elements (needed in some cases, as english adjectives have no plural mark. :( */
142 #define BLF_I18NCONTEXT_PLURAL "Plural"
143
144 /* ID-types contexts. */
145 /* WARNING! Keep it in sync with idtypes in blenkernel/intern/idcode.c */
146 #define BLF_I18NCONTEXT_ID_ACTION               "Action"
147 #define BLF_I18NCONTEXT_ID_ARMATURE             "Armature"
148 #define BLF_I18NCONTEXT_ID_BRUSH                "Brush"
149 #define BLF_I18NCONTEXT_ID_CAMERA               "Camera"
150 #define BLF_I18NCONTEXT_ID_CURVE                "Curve"
151 #define BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE   "FreestyleLineStyle"
152 #define BLF_I18NCONTEXT_ID_GPENCIL              "GPencil"
153 #define BLF_I18NCONTEXT_ID_GROUP                "Group"
154 #define BLF_I18NCONTEXT_ID_ID                   "ID"
155 #define BLF_I18NCONTEXT_ID_IMAGE                "Image"
156 /*#define BLF_I18NCONTEXT_ID_IPO                  "Ipo"*/ /* Deprecated */
157 #define BLF_I18NCONTEXT_ID_SHAPEKEY             "Key"
158 #define BLF_I18NCONTEXT_ID_LAMP                 "Lamp"
159 #define BLF_I18NCONTEXT_ID_LIBRARY              "Library"
160 #define BLF_I18NCONTEXT_ID_LATTICE              "Lattice"
161 #define BLF_I18NCONTEXT_ID_MATERIAL             "Material"
162 #define BLF_I18NCONTEXT_ID_METABALL             "Metaball"
163 #define BLF_I18NCONTEXT_ID_MESH                 "Mesh"
164 #define BLF_I18NCONTEXT_ID_NODETREE             "NodeTree"
165 #define BLF_I18NCONTEXT_ID_OBJECT               "Object"
166 #define BLF_I18NCONTEXT_ID_PARTICLESETTINGS     "ParticleSettings"
167 #define BLF_I18NCONTEXT_ID_SCENE                "Scene"
168 #define BLF_I18NCONTEXT_ID_SCREEN               "Screen"
169 #define BLF_I18NCONTEXT_ID_SEQUENCE             "Sequence"
170 #define BLF_I18NCONTEXT_ID_SPEAKER              "Speaker"
171 #define BLF_I18NCONTEXT_ID_SOUND                "Sound"
172 #define BLF_I18NCONTEXT_ID_TEXTURE              "Texture"
173 #define BLF_I18NCONTEXT_ID_TEXT                 "Text"
174 #define BLF_I18NCONTEXT_ID_VFONT                "VFont"
175 #define BLF_I18NCONTEXT_ID_WORLD                "World"
176 #define BLF_I18NCONTEXT_ID_WINDOWMANAGER        "WindowManager"
177 #define BLF_I18NCONTEXT_ID_MOVIECLIP            "MovieClip"
178 #define BLF_I18NCONTEXT_ID_MASK                 "Mask"
179
180 /* Helper for bpy.app.i18n object... */
181 typedef struct
182 {
183         const char *c_id;
184         const char *py_id;
185         const char *value;
186 } BLF_i18n_contexts_descriptor;
187
188 #define BLF_I18NCONTEXTS_ITEM(ctxt_id, py_id) {#ctxt_id, py_id, ctxt_id}
189
190 #define BLF_I18NCONTEXTS_DESC {                                                                                        \
191         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT, "default_real"),                                                    \
192         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT_BPYRNA, "default"),                                                  \
193         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "operator_default"),                                       \
194         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_PLURAL, "plural"),                                                           \
195         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ACTION, "id_action"),                                                     \
196         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ARMATURE, "id_armature"),                                                 \
197         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_BRUSH, "id_brush"),                                                       \
198         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_CAMERA, "id_camera"),                                                     \
199         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_CURVE, "id_curve"),                                                       \
200         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE, "id_fs_linestyle"),                                   \
201         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_GPENCIL, "id_gpencil"),                                                   \
202         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_GROUP, "id_group"),                                                       \
203         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ID, "id_id"),                                                             \
204         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_IMAGE, "id_image"),                                                       \
205         /*BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_IPO, "id_ipo"),*/                                                       \
206         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_SHAPEKEY, "id_shapekey"),                                                 \
207         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_LAMP, "id_lamp"),                                                         \
208         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_LIBRARY, "id_library"),                                                   \
209         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_LATTICE, "id_lattice"),                                                   \
210         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_MATERIAL, "id_material"),                                                 \
211         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_METABALL, "id_metaball"),                                                 \
212         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_MESH, "id_mesh"),                                                         \
213         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_NODETREE, "id_nodetree"),                                                 \
214         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_OBJECT, "id_object"),                                                     \
215         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_PARTICLESETTINGS, "id_particlesettings"),                                 \
216         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_SCENE, "id_scene"),                                                       \
217         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_SCREEN, "id_screen"),                                                     \
218         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_SEQUENCE, "id_sequence"),                                                 \
219         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_SPEAKER, "id_speaker"),                                                   \
220         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_SOUND, "id_sound"),                                                       \
221         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_TEXTURE, "id_texture"),                                                   \
222         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_TEXT, "id_text"),                                                         \
223         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_VFONT, "id_vfont"),                                                       \
224         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_WORLD, "id_world"),                                                       \
225         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_WINDOWMANAGER, "id_windowmanager"),                                       \
226         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_MOVIECLIP, "id_movieclip"),                                               \
227         BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_MASK, "id_mask"),                                                         \
228         {NULL, NULL, NULL}                                                                                                 \
229 }
230
231 #ifdef __cplusplus
232 };
233 #endif
234
235 #endif /* __BLF_TRANSLATION_H__ */