-
Notifications
You must be signed in to change notification settings - Fork 6k
Send platformResolvedLocale from iOS embedder #18519
Conversation
| NSString* countryCode = [platformResolvedLocale objectForKey:NSLocaleCountryCode]; | ||
| NSString* scriptCode = [platformResolvedLocale objectForKey:NSLocaleScriptCode]; | ||
| NSString* variantCode = [platformResolvedLocale objectForKey:NSLocaleVariantCode]; | ||
| if (languageCode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a pointer to the Android side of platform-resolved locales? That just helps with making sure that I can see what I'm comparing this to when looking at this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| [self.localizationChannel invokeMethod:@"setPlatformResolvedLocale" arguments:localeData]; | ||
| } | ||
|
|
||
| // Get and pass the user's perferred locale list to dart:ui |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
| // Get and pass the user's perferred locale list to dart:ui | |
| // Get and pass the user's preferred locale list to dart:ui |
| - (void)testNoLocalePrepend { | ||
| NSTimeInterval timeout = 10.0; | ||
|
|
||
| // The locales recieved by dart:ui are exposed onBeginFrame via semantics label. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
| // The locales recieved by dart:ui are exposed onBeginFrame via semantics label. | |
| // The locales received by dart:ui are exposed onBeginFrame via semantics label. |
| NSTimeInterval timeout = 10.0; | ||
|
|
||
| // The locales recieved by dart:ui are exposed onBeginFrame via semantics label. | ||
| // There should only be one locale, as we have removed the locale prepend on iOS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe tweak the comment a little to describe why there should only be one locale. A newer Flutter developer reading this might get confused about what the "locale prepend on iOS" is since it never existed before the PR where it was removed.
| : assert(window != null), | ||
| super(window); | ||
|
|
||
| int tapCount = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, here and elsewhere (might be why the analyzer is failing too)
| int tapCount = 0; | |
| int _tapCount = 0; |
| void onPointerDataPacket(PointerDataPacket packet) { | ||
| String label; | ||
| switch(tapCount) { | ||
| case 0: label = window.platformResolvedLocale.toString(); break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I find this syntax hard to read even though it's shorter, I'd prefer:
| case 0: label = window.platformResolvedLocale.toString(); break; | |
| case 0: { | |
| label = window.platformResolvedLocale.toString(); | |
| } | |
| break; |
| void onPointerDataPacket(PointerDataPacket packet) { | ||
| String label; | ||
| switch(tapCount) { | ||
| case 0: label = window.platformResolvedLocale.toString(); break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, to make sure, keeping track of the _tapCount is solely to make sure we set the semantics label with the platform resolve locale on the first tap? Is there a reason we want it to only set it the first time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect to extend this in the future with further cases, and this allows easy extension by just adding an extra case here and sending another tap.
shihaohong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Roll Engine from 9ce1e5c to 1a83498 (69 revisions) flutter/engine@9ce1e5c...1a83498 2020-05-26 [email protected] Revert "Update CanvasKit to 0.15.0 (flutter#18570)" (flutter/engine#18600) 2020-05-26 [email protected] Roll Fuchsia Mac SDK from TSEOq... to hr-HZ... (flutter/engine#18594) 2020-05-26 [email protected] Roll Dart SDK from 65113fd73dec to 9e3b0289197d (2 revisions) (flutter/engine#18593) 2020-05-26 [email protected] Roll Skia from b6d158aaf3dd to e4b4ca1050b9 (1 revision) (flutter/engine#18592) 2020-05-26 [email protected] Roll Fuchsia Linux SDK from DzG49... to pLp67... (flutter/engine#18591) 2020-05-24 [email protected] Roll Fuchsia Mac SDK from Oz016... to TSEOq... (flutter/engine#18590) 2020-05-23 [email protected] Roll Skia from afd8a6c6ae87 to b6d158aaf3dd (3 revisions) (flutter/engine#18588) 2020-05-22 [email protected] Roll Fuchsia Mac SDK from 99Z4_... to Oz016... (flutter/engine#18582) 2020-05-22 [email protected] Roll Skia from ec31488ace66 to afd8a6c6ae87 (1 revision) (flutter/engine#18581) 2020-05-22 [email protected] Roll Fuchsia Linux SDK from Kvwlr... to DzG49... (flutter/engine#18580) 2020-05-22 [email protected] Roll Skia from 80abb89c3632 to ec31488ace66 (1 revision) (flutter/engine#18579) 2020-05-22 [email protected] Roll Skia from da90c3765908 to 80abb89c3632 (4 revisions) (flutter/engine#18577) 2020-05-22 [email protected] Roll Fuchsia Mac SDK from _zNmv... to 99Z4_... (flutter/engine#18576) 2020-05-22 [email protected] Roll Skia from 317dce5c81c0 to da90c3765908 (1 revision) (flutter/engine#18575) 2020-05-22 [email protected] Roll Dart SDK from 4ee57c08e0a6 to 65113fd73dec (3 revisions) (flutter/engine#18574) 2020-05-22 [email protected] Roll Skia from 67e21a19259b to 317dce5c81c0 (3 revisions) (flutter/engine#18573) 2020-05-22 [email protected] Update CanvasKit to 0.15.0 (flutter/engine#18570) 2020-05-21 [email protected] Roll Skia from 3d52abc84667 to 67e21a19259b (1 revision) (flutter/engine#18568) 2020-05-21 [email protected] Roll Dart SDK from 396b5fb7a97d to 4ee57c08e0a6 (6 revisions) (flutter/engine#18567) 2020-05-21 [email protected] Add fl_value_to_string (flutter/engine#18540) 2020-05-21 [email protected] Roll Skia from 1e63279156d6 to 3d52abc84667 (5 revisions) (flutter/engine#18566) 2020-05-21 [email protected] null-annotate semantics.dart (flutter/engine#18553) 2020-05-21 [email protected] Roll Fuchsia Linux SDK from ciqRH... to Kvwlr... (flutter/engine#18565) 2020-05-21 [email protected] Roll Skia from b37105ea6cca to 1e63279156d6 (9 revisions) (flutter/engine#18564) 2020-05-21 [email protected] Implement WriteAtomically using write/fsync on all platforms, and enable (flutter/engine#18320) 2020-05-21 [email protected] Roll Dart SDK from ecce58c1e354 to 396b5fb7a97d (2 revisions) (flutter/engine#18560) 2020-05-21 [email protected] Roll Fuchsia Mac SDK from RNByJ... to _zNmv... (flutter/engine#18558) 2020-05-21 [email protected] [profiling] Memory Profiling support for iOS (flutter/engine#18516) 2020-05-21 [email protected] Roll Skia from 22636205ce92 to b37105ea6cca (2 revisions) (flutter/engine#18557) 2020-05-21 [email protected] Roll Dart SDK from d551980ac9fc to ecce58c1e354 (2 revisions) (flutter/engine#18556) 2020-05-21 [email protected] Roll Dart SDK from bf7e9d13d730 to d551980ac9fc (6 revisions) (flutter/engine#18551) 2020-05-21 [email protected] Roll Skia from 4c0578632217 to 22636205ce92 (4 revisions) (flutter/engine#18550) 2020-05-21 [email protected] Roll Fuchsia Linux SDK from ThMeW... to ciqRH... (flutter/engine#18549) 2020-05-21 [email protected] Roll Skia from 67ff541ac116 to 4c0578632217 (1 revision) (flutter/engine#18547) 2020-05-21 [email protected] Let run_tests.py just stream output (flutter/engine#18534) 2020-05-21 [email protected] Add FlKeyEventPlugin (flutter/engine#18313) 2020-05-21 [email protected] Add tests for StandardMethodCodec (flutter/engine#18521) 2020-05-21 [email protected] Roll Skia from f83baf230c69 to 67ff541ac116 (1 revision) (flutter/engine#18545) 2020-05-21 [email protected] Roll Fuchsia Mac SDK from 3o9aQ... to RNByJ... (flutter/engine#18543) 2020-05-21 [email protected] fuchsia: Fix runtime_tests and shell_tests (flutter/engine#18492) 2020-05-21 [email protected] Roll Skia from d2dc8ddcdf5e to f83baf230c69 (2 revisions) (flutter/engine#18539) 2020-05-21 [email protected] Roll Dart SDK from 7aa8656d1dd8 to bf7e9d13d730 (21 revisions) (flutter/engine#18538) 2020-05-21 [email protected] Add FlMethodChannel, FlMethodCodec, FlStandardMethodCodec and FlJsonMethodCodec (flutter/engine#18220) 2020-05-20 [email protected] [web] Fix arc rendering when it starts a new sub path. (flutter/engine#18535) 2020-05-20 [email protected] Send platformResolvedLocale from iOS embedder (flutter/engine#18519) 2020-05-20 [email protected] System mouse cursor: macOS (flutter/engine#18131) ...
The code is dead because flutter#17755 has been reverted by flutter#19136 but flutter#18519 has not been properly reverted.
The code is dead because flutter#17755 has been reverted by flutter#19136, although flutter#18519 has not been properly reverted.
Matches android in sending platform resolved locales. The currently computed value is incorrect as the embedder does not yet have access to supported locales. This is ok because the value is not yet exposed to the user. When the embedder localization work is completed, the value will be computed properly.
See flutter/flutter#47087 and #17755