mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
Locale (Windows): uses $LANG if available e.g. MSYS2
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user