| Flutter Windows Embedder |

system_utils.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file contains utilities for system-level information/settings.
6
7 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_SYSTEM_UTILS_H_
8 #define FLUTTER_SHELL_PLATFORM_WINDOWS_SYSTEM_UTILS_H_
9
10 #include <string>
11 #include <vector>
12
13 #include "flutter/shell/platform/windows/windows_proc_table.h"
14
15 namespace flutter {
16
17 // Registry key for user-preferred languages.
18 constexpr const wchar_t kGetPreferredLanguageRegKey[] =
19 L"Control panel\\International\\User Profile";
20 constexpr const wchar_t kGetPreferredLanguageRegValue[] = L"Languages";
21
22 // Components of a system language/locale.
23 struct LanguageInfo {
24 std::string language;
25 std::string region;
26 std::string script;
27 };
28
29 // Returns the list of user-preferred languages, in preference order,
30 // parsed into LanguageInfo structures.
31 std::vector<LanguageInfo> GetPreferredLanguageInfo(
32 const WindowsProcTable& windows_proc_table);
33
34 // Retrieve the preferred languages from the MUI API.
35 std::wstring GetPreferredLanguagesFromMUI(
36 const WindowsProcTable& windows_proc_table);
37
38 // Returns the list of user-preferred languages, in preference order.
39 // The language names are as described at:
40 // https://docs.microsoft.com/en-us/windows/win32/intl/language-names
41 std::vector<std::wstring> GetPreferredLanguages(
42 const WindowsProcTable& windows_proc_table);
43
44 // Parses a Windows language name into its components.
45 LanguageInfo ParseLanguageName(std::wstring language_name);
46
47 // Returns the user's system time format string.
48 std::wstring GetUserTimeFormat();
49
50 // Returns true if the time_format is set to use 24 hour time.
51 bool Prefer24HourTime(std::wstring time_format);
52
53 } // namespace flutter
54
55 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_SYSTEM_UTILS_H_
flutter::LanguageInfo::script
std::string script
Definition: system_utils.h:26
flutter::GetPreferredLanguagesFromMUI
std::wstring GetPreferredLanguagesFromMUI(const WindowsProcTable &windows_proc_table)
Definition: system_utils.cc:28
flutter::kGetPreferredLanguageRegValue
constexpr const wchar_t kGetPreferredLanguageRegValue[]
Definition: system_utils.h:20
flutter::GetPreferredLanguageInfo
std::vector< LanguageInfo > GetPreferredLanguageInfo(const WindowsProcTable &windows_proc_table)
Definition: system_utils.cc:15
flutter::GetUserTimeFormat
std::wstring GetUserTimeFormat()
Definition: system_utils.cc:101
flutter::kGetPreferredLanguageRegKey
constexpr const wchar_t kGetPreferredLanguageRegKey[]
Definition: system_utils.h:18
windows_proc_table.h
flutter::Prefer24HourTime
bool Prefer24HourTime(std::wstring time_format)
Definition: system_utils.cc:113
flutter::ParseLanguageName
LanguageInfo ParseLanguageName(std::wstring language_name)
Definition: system_utils.cc:71
flutter::LanguageInfo::language
std::string language
Definition: system_utils.h:24
flutter::LanguageInfo
Definition: system_utils.h:23
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::WindowsProcTable
Definition: windows_proc_table.h:17
flutter::LanguageInfo::region
std::string region
Definition: system_utils.h:25
flutter::GetPreferredLanguages
std::vector< std::wstring > GetPreferredLanguages(const WindowsProcTable &windows_proc_table)
Definition: system_utils.cc:45