Locale (Windows): print standard format

This commit is contained in:
李通洲
2024-01-15 14:50:47 +08:00
parent e1af6fc0fe
commit c1ed0a4e91
3 changed files with 23 additions and 1 deletions
+18
View File
@@ -0,0 +1,18 @@
#include "detection/locale/locale.h"
#include "util/windows/unicode.h"
#include <windows.h>
#include <locale.h>
void ffDetectLocale(FFstrbuf* result)
{
wchar_t name[LOCALE_NAME_MAX_LENGTH];
int size = GetUserDefaultLocaleName(name, LOCALE_NAME_MAX_LENGTH);
if (size > 1) // including '\0'
{
ffStrbufSetNWS(result, (uint32_t)size - 1, name);
ffStrbufAppendS(result, ".UTF-8"); // set explictly in `ffInitInstance`
}
else
ffStrbufSetS(result, setlocale(LC_ALL, NULL));
}