Locale (Windows): uses $LANG if available e.g. MSYS2

This commit is contained in:
李通洲
2026-08-12 10:19:22 +08:00
parent 16b10c162b
commit 1d12003555
+11 -1
View File
@@ -1,9 +1,19 @@
#include "detection/locale/locale.h"
#include "common/windows/unicode.h"
#include <windows.h>
#include <winnls.h>
const char* ffDetectLocale(FFstrbuf* result) {
ffStrbufAppendS(result, getenv("LC_ALL"));
if (result->length > 0) {
return nullptr;
}
ffStrbufAppendS(result, getenv("LANG")); // Available in MSYS2 and Cygwin
if (result->length > 0) {
return nullptr;
}
wchar_t name[LOCALE_NAME_MAX_LENGTH];
int size = GetUserDefaultLocaleName(name, LOCALE_NAME_MAX_LENGTH);
if (size <= 1) { // including '\0'