diff options
author | Xiao Xiangquan <xiaoxiangquan@gmail.com> | 2011-06-02 15:22:22 +0400 |
---|---|---|
committer | Xiao Xiangquan <xiaoxiangquan@gmail.com> | 2011-06-02 15:22:22 +0400 |
commit | a40e1302ae68ff4a5ce3078bdacb43653ba5e1af (patch) | |
tree | e48fd29988ec9e7fd2a9df320219ccc97c30f5ec /source/blender/blenfont | |
parent | b0cc5b9d4c47625864272654197c4c6ff3f50976 (diff) |
Almost complete the i18n system, including:
Copy unifont..ttf.gz from source tree to target datafile path( now ONLY works with cmake );
Set the locale the same with system's setting;
If need unicode font, unzip and load unifont when init ui styles;
Apply gettext() to labels in space_info.py, who are the main menu items.
Each of these should have been commit one by one. As they work well according to my tests, so I just lazily send a long list.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 6 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 4 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_lang.c | 15 |
3 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 79c8c3b9a1a..05f383cdace 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -188,6 +188,8 @@ void BLF_lang_init(void); /* Set the current locale. */ void BLF_lang_set(const char *); +/* Get the current locale. */ +char* BLF_lang_get(void); /* Set the current encoding name. */ void BLF_lang_encoding_name(const char *str); @@ -218,4 +220,8 @@ void BLF_dir_free(char **dirs, int count); extern int blf_mono_font; extern int blf_mono_font_render; // dont mess drawing with render threads. +// XXX, me, too +extern int blf_unifont; +extern int blf_unifont_render; // dont mess drawing with render threads. + #endif /* BLF_API_H */ diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 1d2ac298af4..b5ad6ab8ae9 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -76,6 +76,10 @@ static int global_font_dpi= 72; int blf_mono_font= -1; int blf_mono_font_render= -1; +// XXX, should these be made into global_font_'s too? +int blf_unifont= -1; +int blf_unifont_render= -1; + static FontBLF *BLF_get(int fontid) { if (fontid >= 0 && fontid < BLF_MAX_FONT) diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index e7f9d1746ad..6a3e5b1f2ef 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -89,6 +89,7 @@ void BLF_lang_set(const char *str) #if defined (_WIN32) || defined(__APPLE__) BLI_setenv("LANG", str); + BLI_strncpy(global_language, BLI_getenv("LANG"), sizeof(global_language)); #else char *locreturn= setlocale(LC_ALL, str); if (locreturn == NULL) { @@ -101,14 +102,12 @@ void BLF_lang_set(const char *str) MEM_freeN(lang); } - + BLI_strncpy(global_language, locreturn, sizeof(global_language)); setlocale(LC_NUMERIC, "C"); #endif textdomain(DOMAIN_NAME); bindtextdomain(DOMAIN_NAME, global_messagepath); /* bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name); */ - BLI_strncpy(global_language, str, sizeof(global_language)); - } } @@ -118,6 +117,11 @@ void BLF_lang_encoding(const char *str) /* bind_textdomain_codeset(DOMAIN_NAME, encoding_name); */ } +char* BLF_lang_get(void) +{ + return global_language; +} + #else /* ! INTERNATIONAL */ void BLF_lang_init(void) @@ -137,4 +141,9 @@ void BLF_lang_set(const char *str) return; } +char* BLF_lang_get(void) +{ + return ""; +} + #endif /* INTERNATIONAL */ |