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:
authorBastien Montagne <montagne29@wanadoo.fr>2012-07-09 18:25:35 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-07-09 18:25:35 +0400
commit0dafa97ea3f6d9662299579e5be1875cd28baaae (patch)
tree149bb7181a73dabc619d546a4f153ad6ed3050ad /source/blender/blenfont
parentfacb1512c097189e50808f6aca7c9f0b0280d2dc (diff)
UI translation from inside Blender UI: first part.
This commit reshapes a bit runtime button info getter, by adding a new uiButGetStrInfo() which accepts a variable number of uiStringInfo parameters, and tries to fill them with the requested strings, for the given button (label, tip, context, RNA identifier, keymap, etc.). Currently used mostly by existing ui_tooltip_create(), and new UI_OT_edittranslation_init operator. It also adds a few getters (to get RNA i18n context, and current language iso code). Finally, it adds to C operators needed for the py ui_translation addon: *UI_OT_edittranslation_init, which gathers requested data and launch the py operator. *UI_OT_reloadtranslation, which forces a full reload of the whole UI translation (including rechecking the directory containing mo files). For the first operator to work, it also adds a new user preferences path: i18n_branches_directory, to point to the /branch part of a bf-translation checkout.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/BLF_translation.h2
-rw-r--r--source/blender/blenfont/intern/blf_lang.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index 2c786f87521..56eabf4bb43 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -54,6 +54,8 @@ void BLF_lang_init(void);
/* Set the current locale. */
void BLF_lang_set(const char *);
+/* Get the current locale (short code, e.g. es_ES). */
+const char *BLF_lang_get(void);
/* Set the current encoding name. */
void BLF_lang_encoding(const char *str);
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 88d34b5e36f..9e8884ad94d 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -112,7 +112,8 @@ static const char *locales[] = {
void BLF_lang_init(void)
{
char *messagepath = BLI_get_folder(BLENDER_DATAFILES, "locale");
-
+/* printf("%s\n", messagepath);*/
+
BLI_strncpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT, sizeof(global_encoding_name));
if (messagepath) {
@@ -276,6 +277,11 @@ void BLF_lang_set(const char *str)
bind_textdomain_codeset(TEXT_DOMAIN_NAME, global_encoding_name);
}
+const char *BLF_lang_get(void)
+{
+ return locales[2 * U.language + 1];
+}
+
void BLF_lang_encoding(const char *str)
{
BLI_strncpy(global_encoding_name, str, sizeof(global_encoding_name));
@@ -301,4 +307,9 @@ void BLF_lang_set(const char *str)
return;
}
+const char *BLF_lang_get(void)
+{
+ return "";
+}
+
#endif /* WITH_INTERNATIONAL */