aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/win_lcid.cpp
blob: f4901719ecf6efb583499f39933b79bb67aa21fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "windows.h"
#include "stdio.h"

#define BUFFER_SIZE 512
BOOL CALLBACK MyFuncLocaleEx(LPWSTR pStr, DWORD dwFlags, LPARAM lparam) {
    WCHAR wcBuffer[BUFFER_SIZE];
    int bufferSize;

    bufferSize = GetLocaleInfoEx(pStr, LOCALE_SENGLANGUAGE, wcBuffer, BUFFER_SIZE);
    if (bufferSize == 0) {
        wprintf(L"Locale %s had error %d\n", pStr, GetLastError());
        return (TRUE);
    }

    LCID lcid = LocaleNameToLCID(pStr, NULL);
    if (lcid == 0) {
        wprintf(L"Error %d getting LCID\n", GetLastError());
        return (TRUE);
    }

    if (lcid > 0x8000) {
        wprintf(L"//");
    }
    wprintf(L"    { 0x%.4x, \"%s\" }, //%s\n", lcid, pStr, wcBuffer);

    return (TRUE);
}

int main(int argc, wchar_t* argv[]) {
    EnumSystemLocalesEx(MyFuncLocaleEx, LOCALE_ALL, NULL, NULL);
}