Skip to content

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

Merged
fluttergithubbot merged 2 commits into
flutter:masterfrom
goderbauer:pkgIntGenI10n
May 22, 2021
Merged

import pkg:intl when DateFormat or NumberFormat is used#83122
fluttergithubbot merged 2 commits into
flutter:masterfrom
goderbauer:pkgIntGenI10n

Conversation

@goderbauer

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

and here

}

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

@jonahwilliams jonahwilliams left a comment

Copy link
Copy Markdown
Contributor

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 <jonahwilliams@google.com>
Co-authored-by: xubaolin <xubaolin@oppo.com>
Co-authored-by: Michael Goderbauer <goderbauer@google.com>
@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