Skip to content

Commit

Permalink
Windows: Implement GetPreferredLanguages for UWP and support l18n (fl…
Browse files Browse the repository at this point in the history
  • Loading branch information
moko256 authored Jul 23, 2021
1 parent 522a8e2 commit 77710c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ SOTEC GmbH & Co. KG <[email protected]>
Hidenori Matsubayashi <[email protected]>
Sarbagya Dhaubanjar <[email protected]>
Callum Moffat <[email protected]>
Koutaro Mori <[email protected]>
14 changes: 8 additions & 6 deletions shell/platform/windows/system_utils_winuwp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
}

Expand Down

0 comments on commit 77710c5

Please sign in to comment.