Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blentranslation/intern/blt_lang.c
| Show First 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | #ifndef _WIN32 | ||||
| * set in the environment. | * set in the environment. | ||||
| * | * | ||||
| * Ideally we also need to ensure LC_ALL, LC_MESSAGES and others are also | * 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 | * set to a proper value, but currently it's not a huge deal and doesn't | ||||
| * cause any headache. | * cause any headache. | ||||
| * | * | ||||
| * Would also be good to find nicer way to check if LANG is correct. | * Would also be good to find nicer way to check if LANG is correct. | ||||
| */ | */ | ||||
| const char *lang = getenv("LANG"); | const char *lang = BLI_getenv("LANG"); | ||||
| if (lang != NULL) { | if (lang != NULL) { | ||||
| char *old_locale = setlocale(LC_ALL, NULL); | char *old_locale = setlocale(LC_ALL, NULL); | ||||
| /* Make a copy so subsequenct setlocale() doesn't interfere. */ | /* Make a copy so subsequenct setlocale() doesn't interfere. */ | ||||
| old_locale = BLI_strdup(old_locale); | old_locale = BLI_strdup(old_locale); | ||||
| if (setlocale(LC_ALL, lang) == NULL) { | if (setlocale(LC_ALL, lang) == NULL) { | ||||
| setenv("LANG", "C", 1); | setenv("LANG", "C", 1); | ||||
| printf("Warning: Falling back to the standard locale (\"C\")\n"); | printf("Warning: Falling back to the standard locale (\"C\")\n"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines | |||||