void BLF_lang_init(void) { #ifdef WITH_INTERNATIONAL const char * const messagepath = BLI_get_folder(BLENDER_DATAFILES, "locale"); if (messagepath) { bl_locale_init(messagepath, TEXT_DOMAIN_NAME); fill_locales(); } else { printf("%s: 'locale' data path for translations not found, continuing\n", __func__); } #else #endif }
void BLT_lang_init(void) { #ifdef WITH_INTERNATIONAL const char * const messagepath = BKE_appdir_folder_id(BLENDER_DATAFILES, "locale"); #endif /* Make sure LANG is correct and wouldn't cause std::rumtime_error. */ #ifndef _WIN32 /* TODO(sergey): This code only ensures LANG is set properly, so later when * Cycles will try to use file system API from boost there'll be no runtime * exception generated by std::locale() which _requires_ having proper LANG * set in the environment. * * Ideally we also need to ensure LC_ALL, LC_MESSAGES and others are also * set to a proper value, but currently it's not a huge deal and doesn't * cause any headache. * * Would also be good to find nicer way to check if LANG is correct. */ const char *lang = getenv("LANG"); if (lang != NULL) { char *old_locale = setlocale(LC_ALL, NULL); /* Make a copy so subsequenct setlocale() doesn't interfere. */ old_locale = BLI_strdup(old_locale); if (setlocale(LC_ALL, lang) == NULL) { setenv("LANG", "C", 1); printf("Warning: Falling back to the standard locale (\"C\")\n"); } setlocale(LC_ALL, old_locale); MEM_freeN(old_locale); } #endif #ifdef WITH_INTERNATIONAL if (messagepath) { bl_locale_init(messagepath, TEXT_DOMAIN_NAME); fill_locales(); } else { printf("%s: 'locale' data path for translations not found, continuing\n", __func__); } #else #endif }