Print all std::locale names (Windows)

前端 未结 1 794
滥情空心
滥情空心 2020-12-30 05:22

My program checks for uppercase letters in German language.

#include 
#include 
#include <         


        
相关标签:
1条回答
  • 2020-12-30 06:00

    I wrote a program to print all supported locale names.

    #include <Windows.h>
    
    #include <iostream>
    #include <string>
    #include <vector>
    #include <algorithm>
    #include <ostream>
    #include <iterator>
    
    using namespace std;
    
    vector<wstring> locals;
    
    BOOL CALLBACK MyFuncLocaleEx(LPWSTR pStr, DWORD dwFlags, LPARAM lparam)
    {
        locals.push_back(pStr);
        return TRUE;
    }
    
    int _tmain(int argc, _TCHAR* argv[])
    {
        EnumSystemLocalesEx(MyFuncLocaleEx, LOCALE_ALL, NULL, NULL);
    
        for (vector<wstring>::const_iterator str = locals.begin(); str != locals.end(); ++str)
            wcout << *str << endl;
    
        wcout << "Total " << locals.size() << " locals found." << endl;
    
        return 0;
    }
    

    Works great.

    ...
    de
    de-AT
    de-CH
    de-DE
    de-DE_phoneb
    de-LI
    de-LU
    ...    
    Total 429 locals found.
    
    0 讨论(0)
提交回复
热议问题