Commit a24db0a7 authored by Felix Paul Kühne's avatar Felix Paul Kühne

bin/darwinvlc: fix l10n preferences lookup code

parent ffff39ac
...@@ -168,22 +168,28 @@ int main( int i_argc, const char *ppsz_argv[] ) ...@@ -168,22 +168,28 @@ int main( int i_argc, const char *ppsz_argv[] )
continue; continue;
} }
} }
if (lang && strncmp( lang, "auto", 4 )) {
char tmp[11];
snprintf(tmp, 11, "LANG%s", lang);
putenv(tmp);
}
if (!lang) { if (!lang) {
CFStringRef language; CFStringRef language;
language = (CFStringRef)CFPreferencesCopyAppValue(CFSTR("language"), language = (CFStringRef)CFPreferencesCopyAppValue(CFSTR("language"),
kCFPreferencesCurrentApplication); kCFPreferencesCurrentApplication);
if (language) { if (language) {
if (CFStringGetLength(language) > 0) CFIndex length = CFStringGetLength(language) + 1;
lang = (char *)CFStringGetCStringPtr(language, kCFStringEncodingUTF8); if (length > 0) {
CFRelease(language); CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
lang = (char *)malloc(maxSize);
CFStringGetCString(language, lang, maxSize - 1, kCFStringEncodingUTF8);
} }
}
if (lang && strncmp( lang, "auto", 4 )) {
char tmp[11]; char tmp[11];
snprintf(tmp, 11, "LANG%s", lang); snprintf(tmp, 11, "LANG=%s", lang);
putenv(tmp); putenv(tmp);
CFRelease(language);
}
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment