-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Use no locale as synonym for nb
#53880
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
Use no locale as synonym for nb
#53880
Conversation
no locale as synonym for nbno locale as synonym for nb
| assert(supportedLanguagesConstant.isNotEmpty); | ||
| assert(supportedLanguagesDocMacro.isNotEmpty); | ||
|
|
||
| bool isNbSynonymOfNo = false; |
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 I can come up with a better variable name. It reads oddly when I say it out loud
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.
The name seems OK (we're deep in a corner here) but a comment that referred to #53036 would be helpful
HansMuller
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.
This change, and the analysis in #53036, looks good. Only concern is about the changes in material_nb.arb when it was renamed (?) material_no.arb.
| assert(supportedLanguagesConstant.isNotEmpty); | ||
| assert(supportedLanguagesDocMacro.isNotEmpty); | ||
|
|
||
| bool isNbSynonymOfNo = false; |
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.
The name seems OK (we're deep in a corner here) but a comment that referred to #53036 would be helpful
|
|
||
| // If scriptCodes for a language are defined, we expect a scriptCode to be | ||
| // defined for locales that contain a countryCode. The superclass becomes | ||
| // the script sublcass (e.g. `MaterialLocalizationZhHant`) and the generated |
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.
NICE
| @@ -48,9 +49,7 @@ | |||
| "reorderItemRight": "Flytt til høyre", | |||
| "expandedIconTapHint": "Skjul", | |||
| "collapsedIconTapHint": "Vis", | |||
| "remainingTextFieldCharacterCountZero": "TBD", | |||
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.
If this file was just renamed, why did the messages it contains change?
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.
My description was misleading, I actually ran the translation console script to regenerate the _no.arb files in case anything had changed. I'm not sure why this would be removed instead of saying 'TBD'. Do we want to keep it as-is, or re-introduce the original arb file setup?
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 see, didn't realize we were updating translations. Removing this line is OK; just means that there's no special case for zero.
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.
Turns out there was a manual step to introduce the 'TBD' for any message that does not have a translation in google's translation console. I re-introduced the removed 'TBD' string.
With that, none of the strings are actually updated, the order is somehow different now though (alphabetical, which seems more correct).
| expect(localizations.timerPickerMinute(10), '10'); | ||
| }); | ||
|
|
||
| // See https://github.com/flutter/flutter/issues/53036 for context on why |
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.
Please add the standard "Regression test for ..." comment as well.
| }, throwsAssertionError); | ||
| }); | ||
|
|
||
| test('`nb` uses `no` as a synonym when `nb` arb file is not present', () async { |
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.
Please add the standard "Regression test for ..." comment here.
|
|
||
| // See https://github.com/flutter/flutter/issues/53036 for context on why | ||
| // `no` is being used as a synonym for `nb`. | ||
| testWidgets('`nb` uses `no` as its synonym when `nb` arb file is not present', (WidgetTester tester) async { |
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.
Please add the standard "Regression test for ..." comment as well.
HansMuller
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
| @@ -48,9 +49,7 @@ | |||
| "reorderItemRight": "Flytt til høyre", | |||
| "expandedIconTapHint": "Skjul", | |||
| "collapsedIconTapHint": "Vis", | |||
| "remainingTextFieldCharacterCountZero": "TBD", | |||
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 see, didn't realize we were updating translations. Removing this line is OK; just means that there's no special case for zero.
Description
Uses the
nolocale as a synonym for thenblocale. This is done because some systems like Android usenbto identify Norwegian Bokmål. However, in other systems, like internally at Google,nois used instead. This adds some logic to the Material and Cupertino localizations generation code to havenbbe synonymous withnoin the event that an_nb.arbfile is not provided.I switched
_nb.arbfiles back to to_no.arbfiles, since that is how it is named and pulled down from the Google translation console internally. The name was manually updated to_nb.arbever since #17788, but keeping it as_no.arbkeeps things consistent with how these files are pulled down.Related Issues
Fixes #53036
Tests
I added the following tests:
A test to ensure that
nbis currently being generated as a synonym forno. However, this test wouldn't hold up in the event that an_nb.arbfile is introduced with different message strings thanno. Any feedback here would be appreciated on how to better test this behavior.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.