11 #include "flutter/fml/platform/win/wstring_conversion.h"
17 std::vector<std::wstring> languages =
19 std::vector<LanguageInfo> language_info;
20 language_info.reserve(languages.size());
22 for (
auto language : languages) {
30 ULONG buffer_size = 0;
32 DWORD flags = MUI_LANGUAGE_NAME | MUI_UI_FALLBACK;
35 return std::wstring();
37 std::wstring buffer(buffer_size,
'\0');
39 flags, &count, buffer.data(), &buffer_size)) {
40 return std::wstring();
47 std::vector<std::wstring> languages;
56 if (buffer[start] == L
'\0') {
60 std::wstring language(buffer.c_str() + start);
61 if (language.empty()) {
64 languages.push_back(language);
66 start += language.size() + 1;
75 std::vector<std::string> components;
76 std::istringstream stream(fml::WideStringToUtf8(language_name));
77 std::string component;
78 while (getline(stream, component,
'-')) {
79 if (component ==
"x") {
82 components.push_back(component);
87 if (components.size() == 3) {
88 info.
script = components[1];
89 info.
region = components[2];
90 }
else if (components.size() == 2) {
92 if (components[1].size() == 4) {
93 info.
script = components[1];
95 info.
region = components[1];
104 const int kBufferSize = 100;
105 wchar_t buffer[kBufferSize];
106 if (::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_STIMEFORMAT, buffer,
108 return std::wstring();
110 return std::wstring(buffer, kBufferSize);
114 return time_format.find(L
"H") != std::wstring::npos;