Skip to content

Fix Amharic "in N hours" rendering the seconds noun - #1345

Open
dylanpulver wants to merge 1 commit into
arrow-py:masterfrom
dylanpulver:fix/amharic-hours-future-timeframe
Open

Fix Amharic "in N hours" rendering the seconds noun#1345
dylanpulver wants to merge 1 commit into
arrow-py:masterfrom
dylanpulver:fix/amharic-hours-future-timeframe

Conversation

@dylanpulver

@dylanpulver dylanpulver commented Sep 1, 2026

Copy link
Copy Markdown

Pull Request Checklist

  • 🧪 Added tests for changed code.
  • 🛠️ All tests pass when run locally (run tox or make test to find out!).
  • 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
  • 📚 Updated documentation for changed code.
  • ⏩ Code is up-to-date with the master branch.

Description of Changes

AmharicLocale.timeframes["hours"]["future"] is "በ {0} ሰከንድ" (locales.py:6363) — the
plural second noun ሰከንድ, byte-identical to timeframes["seconds"]["future"]. The past
entry one line above already uses the hour noun ሰዓታት. So a future hour delta renders as
"in N seconds" in Amharic:

>>> b = arrow.Arrow(2024, 6, 15, 12, 0, 0)
>>> b.shift(hours=7).humanize(b, locale="am")
'በ 7 ሰከንድ ውስጥ'          # before: "in 7 seconds"
'በ 7 ሰዓታት ውስጥ'          # after

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") returned 12:00:02, not 14: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 this
locale 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_LOCALES against the en reference left am/am-et as the only
locales disagreeing for a reason other than the documented untranslated-week error, and a
scan 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:3195
asserting _format_timeframe("hours", 7) == "በ 7 ሰከንድ" — the expected value was taken from the
implementation, which is why the suite has been green over it since. That assertion is
corrected here, plus one line asserting the hours and seconds future forms differ.

Measured: pytest tests 1902 passed before and after (same command, same venv). Two
mutants: reverting only locales.py fails the Amharic test and re-raises the sweep's 8
failures; substituting the singular ሰዓት clears the sweep and the collision scan but still
fails 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 past
entry, and a native speaker should confirm ሰዓታት over CLDR's ሰዓቶች. I did not touch the
untranslated-week gap in am or the ~20 other locales that raise on weeks.

Disclosure: the diff, the test change and this description were drafted with Claude Opus 5.

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

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2224255) to head (0bbf309).
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant