| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Merging this PR will not alter performance✅ 88 untouched benchmarks Comparing cldr-48-relative (66e3df0) with master (c2fdae6) |
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## master #1306 +/- ##
==========================================
+ Coverage 92.20% 92.22% +0.02%
==========================================
Files 27 27
Lines 4761 4774 +13
==========================================
+ Hits 4390 4403 +13
Misses 371 371
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
There was a problem hiding this comment.
This PR updates Babel to take advantage of new CLDR 48 data for relative date wording and locale-specific patterns for combining relative dates with times (e.g., “tomorrow at 3:30 PM”).
Changes:
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file| File | Description |
|---|---|
| tests/test_dates.py | Adds coverage for relative-name retrieval and relative date+time formatting behavior across locales/lengths. |
| scripts/import_cldr.py | Extends CLDR import to ingest literal relative names and relative datetime combination patterns. |
| docs/api/dates.rst | Exposes new APIs in the generated documentation. |
| babel/dates.py | Implements get_relative_name() and format_relative_datetime(). |
| babel/core.py | Adds Locale.datetime_formats_relative accessor for CLDR 48 relative datetime patterns. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
|
|
||
| .. versionadded:: 2.19 | ||
| """ | ||
| return self._data['datetime_formats_relative'] |
| locale = Locale.parse(locale or LC_TIME) | ||
| pattern = ( | ||
| locale.datetime_formats_relative.get(format) | ||
| or locale.datetime_formats[format] | ||
| ) |
| assert dates.format_relative_datetime( | ||
| 'demain', time(15, 30), format='full', locale='fr', | ||
| ) == 'demain à 15:30:00 temps universel coordonné' | ||
| # Czech has no relative pattern, so falls back to datetime_formats |
There was a problem hiding this comment.
Surprised there are no relative patterns since they should work fine here, but I guess they'll add them eventually..
Sorry, something went wrong.
There was a problem hiding this comment.
Mmmm, I think this is related to #1076...
Sorry, something went wrong.
There was a problem hiding this comment.
Let's see how this changes after #1310 lands :)
Sorry, something went wrong.
| locale = Locale.parse(locale or LC_TIME) | ||
| date_fields = locale._data['date_fields'] | ||
| key = field if length == 'long' else f'{field}-{length}' | ||
| data = date_fields.get(key) or date_fields.get(field) |
There was a problem hiding this comment.
So if the specified length does not exist, you get the long version by default?
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
New data in CLDR 48, let's make use of it!