Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Windows: Implement GetPreferredLanguages for UWP and support l18n#27311

Merged
chinmaygarde merged 2 commits intoflutter:masterfrom
moko256:moko256_uwp_get_preffered_languages
Jul 23, 2021
Merged

Windows: Implement GetPreferredLanguages for UWP and support l18n#27311
chinmaygarde merged 2 commits intoflutter:masterfrom
moko256:moko256_uwp_get_preffered_languages

Conversation

@moko256
Copy link
Contributor

@moko256 moko256 commented Jul 11, 2021

Fixes flutter/flutter#74156

It implements GetPreferredLanguages for winuwp platform and replace the stub, and support l18n on UWP.
Test on both windows and winuwp for GetPreferredLanguages already exists in master branch.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Copy link
Contributor

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not familar with this subsystem but I took a stab at reviewing this since there weren't any other takers. A couple of clarifications and nits but other LGTM.


#include <sstream>

#include <third_party/cppwinrt/generated/winrt/Windows.Foundation.Collections.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This is not a system header. Please use use quotes instead of angle brackets to include these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


auto platform_langueages = winrt::Windows::System::UserProfile::
GlobalizationPreferences::Languages();
for (auto platform_language : platform_langueages) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does GlobalizationPreferences::Languages need some form of error handling?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: const auto& platform_language

Copy link
Contributor Author

@moko256 moko256 Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moko256
Copy link
Contributor Author

moko256 commented Jul 23, 2021

Thank you @chinmaygarde for your reviewing. I fix them.

@chinmaygarde
Copy link
Contributor

Sorry, one last thing, can this be rebased on ToT please? The presubmits are failing because the commit you built on it too old.

@moko256 moko256 force-pushed the moko256_uwp_get_preffered_languages branch from b6aef71 to 5f4cdf7 Compare July 23, 2021 23:00
@moko256
Copy link
Contributor Author

moko256 commented Jul 23, 2021

done

@chinmaygarde
Copy link
Contributor

Thanks so much!

languages.push_back(L"en-US");
languages.push_back(L"en");

auto platform_langueages = winrt::Windows::System::UserProfile::

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You misspelled languages here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. I'm little busy now so I'll fix it with new PR by tomorrow.

moko256 added a commit to moko256/flutter_engine that referenced this pull request Jul 24, 2021
fluttergithubbot pushed a commit that referenced this pull request Aug 5, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 5, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 6, 2021
fluttergithubbot pushed a commit to flutter/flutter that referenced this pull request Aug 6, 2021
naudzghebre pushed a commit to naudzghebre/engine that referenced this pull request Sep 2, 2021
filmil pushed a commit to filmil/engine that referenced this pull request Apr 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UWP implementation for GetPreferredLanguages

3 participants