-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding tabSemanticsLabel to CupertinoLocalizations #55336
Conversation
@shihaohong does this look about right? I'm going to add some tests, just wanted to check that I wired this up right. :) |
The script made a very large change to packages/flutter_localizations/lib/src/l10n/cupertino_kn.arb |
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.
Everything looks good! The only thing that's missing is running the following commands from your Flutter repo:
dart dev/tools/localization/bin/gen_localizations.dart --overwrite
dart dev/tools/localization/bin/encode_kn_arb_files.dart
The first command generates the localization delegates for each locale so that it will display 'TBD' for non-English locales for the tab label until translations are completed
The second command encodes Kannada script into Unicode escapes so that some versions of emacs do not crash when opening the Flutter repository.
"copyButtonLabel": "\u0ca8\u0c95\u0cb2\u0cbf\u0cb8\u0cbf", | ||
"pasteButtonLabel": "\u0c85\u0c82\u0c9f\u0cbf\u0cb8\u0cbf", | ||
"selectAllButtonLabel": "\u0c8e\u0cb2\u0ccd\u0cb2\u0cb5\u0ca8\u0ccd\u0ca8\u0cc2\u0020\u0c86\u0caf\u0ccd\u0c95\u0cc6\u0cae\u0cbe\u0ca1\u0cbf" | ||
"datePickerHourSemanticsLabelOne": "$hour ಗಂಟೆ", |
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.
This requires running flutter/dev/tools/localization/bin/encode_kn_arb_files.dart
. There's a bug with emacs that causes the editor to crash when it detects certain characters in Kannada script.
I need to still make this part of the gen_localizations
and gen_date_localizations
scripts.
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.
Awesome! Thank you! Updates on the way.
For a unit test, add something similar to https://github.com/flutter/flutter/blob/master/packages/flutter_localizations/test/cupertino/translations_test.dart#L87 and I think you should be good! |
It looks like this may be a breaking change? I think I will have to update the existing tests with |
I think you're right... I just realized that this also changes the behavior for the tab label in other locales (for example, using the |
@Hixie and @HansMuller can you advise on this change? This is breaking in that it
@shihaohong mentioned that I'm still diagnosing a |
CupertinoApp should definitely introduce the l10ns, just like MaterialApp does. |
i would check with devrel that they agree that having the Cupertino library follow the Material library's lead in how to do l10n is a good idea. assuming that they do, then a migration guide should be simple enough to provide. |
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!
Co-Authored-By: Shi-Hao Hong <[email protected]>
Thanks for the guidance and review @shihaohong! 🎉 |
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.
Great. Thanks Kate!
child: Directionality( | ||
textDirection: TextDirection.ltr, | ||
child: widget, | ||
), | ||
), | ||
); | ||
} |
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.
can you add one test for the semantics content of the tabs?
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.
There is already a test for that which was checking the value of the hard-coded string, now it is checking the localized result. :)
testWidgets('tabs announce semantics', (WidgetTester tester) async { |
@Hixie CupertinoApp does introduce localization |
Codecov Report
@@ Coverage Diff @@
## master #55336 +/- ##
=======================================
Coverage 70.59% 70.59%
=======================================
Files 204 204
Lines 22590 22590
=======================================
Hits 15947 15947
Misses 6643 6643
Continue to review full report at Codecov.
|
Description
Closing out this TODO:
flutter/packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
Line 216 in 418007d
This localizes the hint for the tab index to
CupertinoTabBar
.Related Issues
#13452
Tests
Added unit test for
CupertinoLocalizations.tabSemanticsLabel
.Updates affected tests.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.
WIP