Thanks to visit codestin.com
Credit goes to github.com

Skip to content

import pkg:intl when DateFormat or NumberFormat is used #83122

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

Merged
merged 2 commits into from
May 22, 2021

Conversation

goderbauer
Copy link
Member

Fixes #82713.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 21, 2021
@google-cla google-cla bot added the cla: yes label May 21, 2021
@goderbauer goderbauer changed the title import pkg:int when DateFormat or NumberFormat is used import pkg:intl when DateFormat or NumberFormat is used May 21, 2021
)
..loadResources()
..writeOutputFiles(BufferLogger.test());
} on Exception catch (e) {
Copy link
Member

Choose a reason for hiding this comment

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

similar question here, shouldn't this fail if already if an exception is thrown?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll remove it, was just copying from the other test cases.

)
..loadResources()
..writeOutputFiles(BufferLogger.test());
} on Exception catch (e) {
Copy link
Member

Choose a reason for hiding this comment

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

and here

@@ -1168,7 +1168,7 @@ class LocalizationsGenerator {
.replaceAll('\n\n\n', '\n\n');
}

bool _containsPluralMessage() => _allMessages.any((Message message) => message.isPlural);
bool _requiresIntlImport() => _allMessages.any((Message message) => message.isPlural || message.placeholdersRequireFormatting);
Copy link
Member

Choose a reason for hiding this comment

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

is the plan to keep adding onto this or is there a comprehensive list of intl type usage?

Copy link
Member Author

Choose a reason for hiding this comment

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

As far as I can tell, it's a case by case decision whether a feature needs intl or not. If we add more features, this list would grow.

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM with nit + question

@fluttergithubbot fluttergithubbot merged commit 485c409 into flutter:master May 22, 2021
christopherfujino pushed a commit to chris-forks/flutter that referenced this pull request Jun 10, 2021
christopherfujino added a commit that referenced this pull request Jun 11, 2021
* [flutter_tools] throw a tool exit if pub cannot be run (#83293)
* Re-add the removed MediaQuery.removePadding of PopupMenuButton (#82986)
* import pkg:intl when DateFormat or NumberFormat is used (#83122)

Co-authored-by: Jonah Williams <[email protected]>
Co-authored-by: xubaolin <[email protected]>
Co-authored-by: Michael Goderbauer <[email protected]>
@goderbauer goderbauer deleted the pkgIntGenI10n branch March 3, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gen_l10n: Using DateTime produces error during code generation
3 participants