Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @mosuem, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces significant API cleanups and refactoring across the Intl4x library. The primary focus is on redesigning the DateTimeFormat API to offer a more fluent and composable approach to date and time formatting, including enhanced control over timezone display. Additionally, the LocaleMatcher concept has been entirely removed from the library, simplifying the overall API surface and reducing configuration overhead for all internationalization features. These changes aim to improve the usability and maintainability of the Intl4x package.
Highlights
- DateTimeFormat API Redesign: The
DateTimeFormatclass has been significantly refactored. Instead of directly returning formatted strings, methods liked(),m(),y(),ymd(),time(), etc., now return dedicated formatter objects (e.g.,DateFormatter,TimeFormatter,DateTimeFormatter). These formatter objects then expose aformat(DateTime datetime)method, enabling a more fluent and chainable API for date and time formatting (e.g.,intl.dateTimeFormat().d().format(dateTime)). - Enhanced Time Zone Formatting: New
withTimezonemethods have been introduced on the new formatter objects (e.g.,withTimezoneShort,withTimezoneLong,withTimeZoneShortOffset, etc.). This provides explicit control over how time zones are applied during date and time formatting, allowing for more precise and flexible timezone display options. - Removal of LocaleMatcher: The
LocaleMatcherconcept and its associated property have been completely removed from theIntlclass and all internationalization feature options (CaseMapping, Collation, DateTimeFormat, DisplayNames, ListFormat, NumberFormat, PluralRules). This simplifies the API by removing a configuration option that was likely redundant or unnecessary for the library's intended use cases, streamlining API calls and reducing complexity. - Internal Code Simplification: Various internal code cleanups have been performed across the library. This includes the removal of unused imports (e.g.,
package:meta/meta.dart), deprecated helper functions (e.g.,_isUnusedSymbolinhook/link.dart), and general code simplification, contributing to a leaner and more maintainable codebase.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces significant API cleanups, most notably removing the LocaleMatcher parameter from most top-level functions and refactoring the DateTimeFormat API to a more fluent, builder-style pattern. These changes greatly simplify the public API. The refactoring of DateTimeFormat is extensive and introduces a set of Formatter classes, which is a good design. However, I've found a few issues: a critical bug in the ECMA implementation for timezone formatting, some API naming inconsistencies and missing documentation in the new DateTimeFormat API, and some leftover commented-out code and an incomplete comment.
PR HealthBreaking changes ✔️
This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with
Coverage
|
| File | Coverage |
|---|---|
| pkgs/intl4x/example/bin/example.dart | 💔 Not covered |
| pkgs/intl4x/lib/datetime_format.dart | 💔 Not covered |
| pkgs/intl4x/lib/intl4x.dart | 💚 100 % ⬆️ 14 % |
| pkgs/intl4x/lib/src/case_mapping/case_mapping_ecma.dart | 💔 Not covered |
| pkgs/intl4x/lib/src/case_mapping/case_mapping_impl.dart | 💚 100 % |
| pkgs/intl4x/lib/src/case_mapping/case_mapping_stub.dart | 💔 0 % ⬇️ NaN % |
| pkgs/intl4x/lib/src/collation/collation_4x.dart | 💚 77 % |
| pkgs/intl4x/lib/src/collation/collation_ecma.dart | 💔 Not covered |
| pkgs/intl4x/lib/src/collation/collation_impl.dart | 💚 100 % |
| pkgs/intl4x/lib/src/collation/collation_options.dart | 💚 9 % ⬆️ 9 % |
| pkgs/intl4x/lib/src/collation/collation_stub.dart | 💔 0 % ⬇️ NaN % |
| pkgs/intl4x/lib/src/datetime_format/datetime_format.dart | 💔 82 % ⬇️ 11 % |
| pkgs/intl4x/lib/src/datetime_format/datetime_format_ecma.dart | 💔 Not covered |
| pkgs/intl4x/lib/src/datetime_format/datetime_format_impl.dart | 💔 85 % ⬇️ 15 % |
| pkgs/intl4x/lib/src/datetime_format/datetime_format_options.dart | 💔 33 % ⬇️ 21 % |
| pkgs/intl4x/lib/src/datetime_format/datetime_format_stub.dart | 💔 0 % ⬇️ NaN % |
| pkgs/intl4x/lib/src/datetime_format/icu4x/date_formatter.dart | 💚 96 % |
| pkgs/intl4x/lib/src/datetime_format/icu4x/date_time_formatter.dart | 💚 95 % |
| pkgs/intl4x/lib/src/datetime_format/icu4x/datetime_format_4x.dart | 💚 90 % |
| pkgs/intl4x/lib/src/datetime_format/icu4x/time_formatter.dart | 💚 9 % |
| pkgs/intl4x/lib/src/display_names/display_names_ecma.dart | 💔 Not covered |
| pkgs/intl4x/lib/src/display_names/display_names_impl.dart | 💚 100 % |
| pkgs/intl4x/lib/src/display_names/display_names_options.dart | 💚 17 % ⬆️ 17 % |
| pkgs/intl4x/lib/src/display_names/display_names_stub.dart | 💔 0 % ⬇️ NaN % |
| pkgs/intl4x/lib/src/list_format/list_format_ecma.dart | 💔 Not covered |
| pkgs/intl4x/lib/src/list_format/list_format_impl.dart | 💚 100 % |
| pkgs/intl4x/lib/src/list_format/list_format_options.dart | 💚 17 % ⬆️ 17 % |
| pkgs/intl4x/lib/src/list_format/list_format_stub.dart | 💔 0 % ⬇️ NaN % |
| pkgs/intl4x/lib/src/number_format/number_format_4x.dart | 💔 91 % ⬇️ 2 % |
| pkgs/intl4x/lib/src/number_format/number_format_ecma.dart | 💔 Not covered |
| pkgs/intl4x/lib/src/number_format/number_format_impl.dart | 💚 100 % |
| pkgs/intl4x/lib/src/number_format/number_format_options.dart | 💚 31 % ⬆️ 1 % |
| pkgs/intl4x/lib/src/number_format/number_format_stub.dart | 💔 0 % ⬇️ NaN % |
| pkgs/intl4x/lib/src/options.dart | 💚 100 % ⬆️ 100 % |
| pkgs/intl4x/lib/src/plural_rules/plural_rules_ecma.dart | 💔 Not covered |
| pkgs/intl4x/lib/src/plural_rules/plural_rules_impl.dart | 💚 100 % |
| pkgs/intl4x/lib/src/plural_rules/plural_rules_options.dart | 💚 22 % ⬆️ 11 % |
| pkgs/intl4x/lib/src/plural_rules/plural_rules_stub.dart | 💔 0 % ⬇️ NaN % |
| pkgs/intl4x/lib/src/utils.dart | 💔 67 % ⬇️ 17 % |
This check for test coverage is informational (issues shown here will not fail the PR).
This check can be disabled by tagging the PR with skip-coverage-check.
API leaks ✔️
The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
| Package | Leaked API symbol | Leaking sources |
|---|
This check can be disabled by tagging the PR with skip-leaking-check.
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
| Files |
|---|
| no missing headers |
All source files should start with a license header.
This check can be disabled by tagging the PR with skip-license-check.
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces significant API cleanups, most notably a more fluent, builder-style API for DateTime formatting and the removal of LocaleMatcher from various option classes. The changes are consistent and well-structured, improving the overall API design. I've identified a few areas for improvement, including removing leftover debugging statements, cleaning up commented-out code, and adding documentation to new public APIs to align with the style guide.
pkgs/intl4x/lib/src/datetime_format/icu4x/date_time_formatter.dart
Outdated
Show resolved
Hide resolved
DateTime formatting redesign
pkgs/intl4x/lib/src/datetime_format/icu4x/datetime_format_4x.dart
Outdated
Show resolved
Hide resolved
pkgs/intl4x/lib/src/datetime_format/datetime_format_options.dart
Outdated
Show resolved
Hide resolved
|
A TBD is also to further remove fields from the |
Co-authored-by: Robert Bastian <4706271+robertbastian@users.noreply.github.com>
|
I think the options should be the union of all options, and then the constructors ignore irrelevant options |
Revisions updated by `dart tools/rev_sdk_deps.dart`. ecosystem (https://github.com/dart-lang/ecosystem/compare/68ff911..fd28be2): fd28be2 2025-08-27 Moritz Dont show warnings by default (dart-lang/ecosystem#365) http (https://github.com/dart-lang/http/compare/6656f15..ef05b37): ef05b37 2025-08-27 Brian Quinlan [cupertino_http]: Switch to ffigen 19.1.0 (dart-lang/http#1811) i18n (https://github.com/dart-lang/i18n/compare/6a8f9c7..9a211d1): 9a211d14 2025-08-27 Moritz [package:intl4x] `DateTime` formatting redesign (dart-lang/i18n#1003) protobuf (https://github.com/dart-lang/protobuf/compare/6e9c9f4..765ba8a): 765ba8a 2025-08-28 Ömer Sinan Ağacan Fix non-proto3 JSON format double decoding (google/protobuf.dart#1043) 703bf7c 2025-08-27 Ömer Sinan Ağacan Compile dart2wasm benchmarks with --no-strip-wasm (google/protobuf.dart#1044) 9939965 2025-08-26 Ömer Sinan Ağacan Fix JS interop annotations (google/protobuf.dart#1042) da354a2 2025-08-22 Ömer Sinan Ağacan Update benchmark builder to use -O2 with dart2wasm, add output dir to gitignore (google/protobuf.dart#1041) 41eba19 2025-08-22 Ömer Sinan Ağacan Add sinks to benchmarks to prevent smart tools eliminating benchmarked code (google/protobuf.dart#1040) 3ccc8ab 2025-08-19 dependabot[bot] Bump actions/checkout from 3.5.3 to 4.2.2 (google/protobuf.dart#1036) 6bce9d7 2025-08-19 Ömer Sinan Ağacan Fix unknown enum handling (google/protobuf.dart#853) 19e5a25 2025-08-15 Ömer Sinan Ağacan Implement deepCopy as copying, instead of merge (google/protobuf.dart#742) web (https://github.com/dart-lang/web/compare/ee9733f..e7895bd): e7895bd 2025-08-27 Nikechukwu [interop] Add Support for Declaration Merging and Overloading (dart-lang/web#449) webdev (https://github.com/dart-lang/webdev/compare/9724fea..a7d3d2f): a7d3d2fc 2025-08-27 Ben Konyi [ DWDS ] Fix issue where null was repeatedly sent to connected clients (dart-lang/webdev#2678) e3009dfb 2025-08-27 Nate Biggs Remove stale calls to dartSdkIsAtLeast. (dart-lang/webdev#2677) e0d58082 2025-08-26 Nate Biggs Fix expectation in test accessing private field. (dart-lang/webdev#2676) Change-Id: Ia98a8f065830865f6922ca032939380683645d72 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447640 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Auto-Submit: Devon Carew <devoncarew@google.com>
Redesign the date/time/datetime formatting to a builder-like style. This get rid of the custom linking process, as we get a closer mapping to the ICU4X API, and improves usability.
The mapping between this API and the ECMA-style API is not perfect, so the options will need another round of refactorings to get them right. Especially, the share
DateTimeFormatOptionsobject should be either removed completely or at least contain only shared options for all formatters.cc @sffc as we talked about this kind of API style.
Contribution guidelines:
dart format.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.