mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Windows: Implement GetPreferredLanguages for UWP and support l18n (flutter/engine#27311)
This commit is contained in:
parent
b14a9f832b
commit
bd9583cd04
@ -19,3 +19,4 @@ SOTEC GmbH & Co. KG <sotec-contributors@sotec.eu>
|
||||
Hidenori Matsubayashi <Hidenori.Matsubayashi@sony.com>
|
||||
Sarbagya Dhaubanjar <mail@sarbagyastha.com.np>
|
||||
Callum Moffat <callum@moffatman.com>
|
||||
Koutaro Mori <koutaro.mo@gmail.com>
|
||||
|
||||
@ -8,6 +8,9 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "third_party/cppwinrt/generated/winrt/Windows.Foundation.Collections.h"
|
||||
#include "third_party/cppwinrt/generated/winrt/Windows.System.UserProfile.h"
|
||||
|
||||
#include "flutter/shell/platform/windows/string_conversion.h"
|
||||
|
||||
namespace flutter {
|
||||
@ -23,12 +26,11 @@ std::vector<LanguageInfo> GetPreferredLanguageInfo() {
|
||||
|
||||
std::vector<std::wstring> GetPreferredLanguages() {
|
||||
std::vector<std::wstring> languages;
|
||||
// TODO(clarkezone) need to implement a complete version of this function in
|
||||
// order to get full list of platform languages
|
||||
// https://github.com/flutter/flutter/issues/74156
|
||||
languages.push_back(L"en-US");
|
||||
languages.push_back(L"en");
|
||||
|
||||
auto platform_langueages = winrt::Windows::System::UserProfile::
|
||||
GlobalizationPreferences::Languages();
|
||||
for (const auto& platform_language : platform_langueages) {
|
||||
languages.push_back(std::wstring{platform_language});
|
||||
}
|
||||
return languages;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user