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[] )
continue;
}
}
if (lang && strncmp( lang, "auto", 4 )) {
char tmp[11];
snprintf(tmp, 11, "LANG%s", lang);
putenv(tmp);
}
if (!lang) {
CFStringRef language;
language = (CFStringRef)CFPreferencesCopyAppValue(CFSTR("language"),
kCFPreferencesCurrentApplication);
if (language) {
if (CFStringGetLength(language) > 0)
lang = (char *)CFStringGetCStringPtr(language, kCFStringEncodingUTF8);
CFRelease(language);
CFIndex length = CFStringGetLength(language) + 1;
if (length > 0) {
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
lang = (char *)malloc(maxSize);
CFStringGetCString(language, lang, maxSize - 1, kCFStringEncodingUTF8);
}
}
if (lang && strncmp( lang, "auto", 4 )) {
char tmp[11];
snprintf(tmp, 11, "LANG%s", lang);
snprintf(tmp, 11, "LANG=%s", lang);
putenv(tmp);
CFRelease(language);
}
}
#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