Fix Amharic "in N hours" rendering the seconds noun - #1345
Open
dylanpulver wants to merge 1 commit into
Open
Conversation
AmharicLocale.timeframes["hours"]["future"] was "በ {0} ሰከንድ" - the plural
SECOND noun (ሰከንድ), identical to timeframes["seconds"]["future"]. The past
form already uses the hour noun ሰዓታት. So humanize() rendered a future
hour delta as "in N seconds" in Amharic, and dehumanize() matched the
string against the seconds pattern.
CLDR (am) uses the hour noun for this unit: in-7-hours = "በ7 ሰዓቶች ውስጥ",
in-7-seconds = "በ7 ሰከንዶች ውስጥ". The fix reuses ሰዓታት, the hour plural
already present in this locale's own "hours"/"past" entry.
The existing assertion for this case was written from the implementation,
so it pinned the wrong string; updated, plus one assertion that the
"hours" and "seconds" future forms differ.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1345 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 10
Lines 2315 2315
Branches 358 358
=========================================
Hits 2315 2315 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
toxormake testto find out!).tox -e lintormake lintto find out!).masterbranch.Description of Changes
AmharicLocale.timeframes["hours"]["future"]is"በ {0} ሰከንድ"(locales.py:6363) — theplural second noun
ሰከንድ, byte-identical totimeframes["seconds"]["future"]. Thepastentry one line above already uses the hour noun
ሰዓታት. So a future hour delta renders as"in N seconds" in Amharic:
It also breaks the
dehumanize()round trip, since the string matches the seconds pattern:b.dehumanize(b.shift(hours=2).humanize(b, locale="am"), locale="am")returned12:00:02, not14:00:00.CLDR uses the hour noun here (ICU 78.2,
Intl.RelativeTimeFormat('am')):+7 hour→"በ7 ሰዓቶች ውስጥ",+7 second→"በ7 ሰከንዶች ውስጥ". The fix reusesሰዓታት, the hour plural thislocale already uses in its own
"hours"/"past"entry, rather than introducing CLDR'sሰዓቶች.Found by a differential sweep, not a report from real use: humanize/dehumanize round trips
across all 133
DEHUMANIZE_LOCALESagainst theenreference leftam/am-etas the onlylocales disagreeing for a reason other than the documented untranslated-
weekerror, and ascan of all 81 locale classes for a timeframe string shared by two different units found
exactly one hit.
b0b45e9(PR #1093) added the table entry and, in the same commit,test_locales.py:3195asserting
_format_timeframe("hours", 7) == "በ 7 ሰከንድ"— the expected value was taken from theimplementation, which is why the suite has been green over it since. That assertion is
corrected here, plus one line asserting the
hoursandsecondsfuture forms differ.Measured:
pytest tests1902 passed before and after (same command, same venv). Twomutants: reverting only
locales.pyfails the Amharic test and re-raises the sweep's 8failures; substituting the singular
ሰዓትclears the sweep and the collision scan but stillfails the test, so the assertion pins the plural form and not merely the collision.
Not tested: I don't read Amharic. The claim rests on CLDR and on this locale's own
pastentry, and a native speaker should confirm
ሰዓታትover CLDR'sሰዓቶች. I did not touch theuntranslated-
weekgap inamor the ~20 other locales that raise onweeks.Disclosure: the diff, the test change and this description were drafted with Claude Opus 5.