Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
15namespace flutter {
16
17// Registry key for user-preferred languages.
18constexpr const wchar_t kGetPreferredLanguageRegKey[] =
19 L"Control panel\\International\\User Profile";
20constexpr const wchar_t kGetPreferredLanguageRegValue[] = L"Languages";
21
22// Components of a system language/locale.
23struct 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.
31std::vector<LanguageInfo> GetPreferredLanguageInfo(
32 const WindowsProcTable& windows_proc_table);
33
34// Retrieve the preferred languages from the MUI API.
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
41std::vector<std::wstring> GetPreferredLanguages(
42 const WindowsProcTable& windows_proc_table);
43
44// Parses a Windows language name into its components.
45LanguageInfo ParseLanguageName(std::wstring language_name);
46
47// Returns the user's system time format string.
48std::wstring GetUserTimeFormat();
49
50// Returns true if the time_format is set to use 24 hour time.
51bool Prefer24HourTime(std::wstring time_format);
52
53} // namespace flutter
54
55#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_SYSTEM_UTILS_H_
std::wstring GetUserTimeFormat()
std::vector< std::wstring > GetPreferredLanguages(const WindowsProcTable &windows_proc_table)
std::wstring GetPreferredLanguagesFromMUI(const WindowsProcTable &windows_proc_table)
std::vector< LanguageInfo > GetPreferredLanguageInfo()
constexpr const wchar_t kGetPreferredLanguageRegKey[]
LanguageInfo ParseLanguageName(std::wstring language_name)
bool Prefer24HourTime(std::wstring time_format)
constexpr const wchar_t kGetPreferredLanguageRegValue[]