complete the language-select feature
authorXiao Xiangquan <xiaoxiangquan@gmail.com>
Mon, 25 Jul 2011 17:05:43 +0000 (17:05 +0000)
committerXiao Xiangquan <xiaoxiangquan@gmail.com>
Mon, 25 Jul 2011 17:05:43 +0000 (17:05 +0000)
po/update_mo.py
po/update_po.py
release/bin/.blender/.Blanguages
source/blender/blenfont/intern/blf_lang.c
source/blender/makesrna/intern/rna_userdef.c
source/creator/CMakeLists.txt

index e361f70d96349ae742af6d3b6fdff20ab559cf52..c0870f3fbb3d8d275e0b0eb13b906d95b95b9edc 100755 (executable)
@@ -5,36 +5,12 @@
 import os
 
 LOCALE_DIR="../release/bin/.blender/locale"
+PO_DIR = "."
 DOMAIN = "blender"
-LANGS = (
-  "ar",
-  "bg",
-  "ca",
-  "cs",
-  "de",
-  "el",
-  "es",
-  "fi",
-  "fr",
-  "hr",
-  "it",
-  "ja",
-  "ko",
-  "nl",
-  "pl",
-  "pt_BR",
-  "ro",
-  "ru",
-  "sr@Latn",
-  "sr",
-  "sv",
-  "uk",
-  "zh_CN",
-  "zh_TW"
-)
 
-#-o %s.new.po
-for lang in LANGS:
+for po in os.listdir( PO_DIR ):
+  if po.endswith(".po"):
+    lang = po[:-3]
     # show stats
     cmd = "msgfmt --statistics %s.po -o %s/%s/LC_MESSAGES/%s.mo" % ( lang, LOCALE_DIR, lang, DOMAIN )
     print cmd
index c01c4bdc32d98387127c85888ef1f1a57322bfba..8a2f61ba46f84918e1a3e0ee3bdbb352c24bf7f9 100755 (executable)
@@ -4,35 +4,12 @@
 
 import os
 
+PO_DIR = "."
 DOMAIN = "blender"
-LANGS = (
-  "ar",
-  "bg",
-  "ca",
-  "cs",
-  "de",
-  "el",
-  "es",
-  "fi",
-  "fr",
-  "hr",
-  "it",
-  "ja",
-  "ko",
-  "nl",
-  "pl",
-  "pt_BR",
-  "ro",
-  "ru",
-  "sr@Latn",
-  "sr",
-  "sv",
-  "uk",
-  "zh_CN",
-  "zh_TW"
-)
-#-o %s.new.po
-for lang in LANGS:
+
+for po in os.listdir( PO_DIR ):
+  if po.endswith(".po"):
+    lang = po[:-3]
     # update po file
     cmd = "msgmerge --update --lang=%s %s.po %s.pot" % (lang, lang, DOMAIN)
     print(cmd)
index 9f3b3ef80dc6f90f3923c1aec330700f787f077f..1a83c46039a2bdf9fa74c0bc3b16d8e5a81a824a 100644 (file)
@@ -11,13 +11,14 @@ Catalan:ca_ES
 Czech:cs_CZ
 Brazilian Portuguese:pt_BR
 Simplified Chinese:zh_CN
+Traditional Chinese:zh_TW
 Russian:ru_RU
 Croatian:hr_HR
-Serbian:sr
+Serbian:sr_RS
 Ukrainian:uk_UA
 Polish:pl_PL
-Romanian:ro
-Arabic:ar
-Bulgarian:bg
-Greek:el
-Korean:ko
+Romanian:ro_RO
+Arabic:ar_SA
+Bulgarian:bg_BG
+Greek:el_GR
+Korean:ko_KR
index ccaab88a2480a10e468ae087c02829697957aaf4..cc55eb585edca3a427c9c67a44dc3d9ed5fe9e06 100644 (file)
@@ -88,7 +88,7 @@ static char locale_serbian[] = "sr_RS";
 static char locale_ukrainian[] = "uk_UA";
 static char locale_polish[] = "pl_PL";
 static char locale_romanian[] = "ro_RO";
-static char locale_arabic[] = "ar_SA";
+static char locale_arabic[] = "ar_EG";
 static char locale_bulgarian[] = "bg_BG";
 static char locale_greek[] = "el_GR";
 static char locale_korean[] = "ko_KR";
@@ -138,33 +138,31 @@ void BLF_lang_init(void)
 void BLF_lang_set(const char *str)
 {
        char *locreturn;
-       if(str==NULL) {
-               if( U.language==1 )
-                       return;
+       if(str==NULL)
                str = lang_to_locale[U.language];
-       }
-#if defined (_WIN32) || defined(__APPLE__)
-               BLI_setenv("LANG", str);
-#else
-               locreturn= setlocale(LC_ALL, str);
-               if (locreturn == NULL) {
-                       char *lang= BLI_sprintfN("%s.UTF-8", str);
+       BLI_setenv("LANG", str);
+       BLI_setenv("LANGUAGE", str);
 
-                       locreturn= setlocale(LC_ALL, lang);
-                       if (locreturn == NULL) {
-                               printf("could not change language to %s nor %s\n", str, lang);
-                       }
+       locreturn= setlocale(LC_ALL, str);
+       if (locreturn == NULL) {
+               char *lang= BLI_sprintfN("%s.UTF-8", str);
 
-                       MEM_freeN(lang);
+               locreturn= setlocale(LC_ALL, lang);
+               if (locreturn == NULL) {
+                       printf("could not change language to %s nor %s\n", str, lang);
                }
 
-               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));
-               
+               MEM_freeN(lang);
+       }
+
+       setlocale(LC_NUMERIC, "C");
+
+       textdomain(DOMAIN_NAME);
+       bindtextdomain(DOMAIN_NAME, global_messagepath);
+       /* bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name); */
+       BLI_strncpy(global_language, str, sizeof(global_language));
+
+//     printf( "<<< %s %s %s \n", setlocale(LC_MESSAGES,NULL), getenv("LANG"), getenv("LANGUAGE") );
 
 }
 
index e7611e450357fd297294223a85b71a5a1874cf97..fe7a2466234305f5b136bf973a8d8d67ccab9a21 100644 (file)
@@ -2442,25 +2442,25 @@ static void rna_def_userdef_system(BlenderRNA *brna)
                {2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"},
                {3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},
                {4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"},
-               {5, "GERMAN", 0, "German (German)", "de_DE"},
-               {6, "FINNISH", 0, "Finnish (Finnish)", "fi_FI"},
-               {7, "SWEDISH", 0, "Swedish (Swedish)", "sv_SE"},
-               {8, "FRENCH", 0, "French (French)", "fr_FR"},
-               {9, "SPANISH", 0, "Spanish (Spanish)", "es_ES"},
-               {10, "CATALAN", 0, "Catalan (Catalan)", "ca_AD"},
-               {11, "CZECH", 0, "Czech (Czech)", "cs_CZ"},
-               {12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Brazilian Portuguese)", "pt_BR"},
+               {5, "GERMAN", 0, "German (Deutsch)", "de_DE"},
+               {6, "FINNISH", 0, "Finnish (Suomalainen)", "fi_FI"},
+               {7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"},
+               {8, "FRENCH", 0, "French (Française)", "fr_FR"},
+               {9, "SPANISH", 0, "Spanish (Español)", "es_ES"},
+               {10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},
+               {11, "CZECH", 0, "Czech (Český)", "cs_CZ"},
+               {12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"},
                {13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", "zh_CN"},
                {14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", "zh_TW"},
-               {15, "RUSSIAN", 0, "Russian (Russian)", "ru_RU"},
-               {16, "CROATIAN", 0, "Croatian (Croatian)", "hr_HR"},
-               {17, "SERBIAN", 0, "Serbian (Serbian)", "sr_RS"},
-               {18, "UKRAINIAN", 0, "Ukrainian (Ukrainian)", "uk_UA"},
-               {19, "POLISH", 0, "Polish (Polish)", "pl_PL"},
+               {15, "RUSSIAN", 0, "Russian (Русский)", "ru_RU"},
+               {16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"},
+               {17, "SERBIAN", 0, "Serbian (Српском језику)", "sr_RS"},
+               {18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"},
+               {19, "POLISH", 0, "Polish (Polski)", "pl_PL"},
                {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"},
-               {21, "ARABIC", 0, "Arabic (العربية)", "ar_SA"},
-               {22, "BULGARIAN", 0, "Bulgarian (Bulgarian)", "bg_BG"},
-               {23, "GREEK", 0, "Greek (Greek)", "el_GR"},
+               {21, "ARABIC", 0, "Arabic (العربية)", "ar_EG"},
+               {22, "BULGARIAN", 0, "Bulgarian (Български)", "bg_BG"},
+               {23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"},
                {24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"},
                {0, NULL, 0, NULL, NULL}};
 
index 3ad0ec8efa4f0682f6a41873ae22e50b1bf5475a..630c85656a46bffdf1d09f9bed72b0c4f565e1e5 100644 (file)
@@ -456,7 +456,7 @@ elseif(WIN32)
 
        install( # same as linux!, deduplicate
                DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
-               DESTINATION ${TARGETDIR_VER}/datafiles/locale
+               DESTINATION ${TARGETDIR_VER}/datafiles
                PATTERN ".svn" EXCLUDE
        )
 
@@ -670,9 +670,14 @@ elseif(APPLE)
 
                install_dir(
                        DIRECTORY
-                                       ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
                                        ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts
-                       \${TARGETDIR_VER}/datafiles/locale
+                       \${TARGETDIR_VER}/datafiles/
+               )
+
+               install_dir(
+                       DIRECTORY
+                                       ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
+                       \${TARGETDIR_VER}/datafiles/
                )
        endif()