Skip to content

Fix misaligned Sinhala day abbreviations - #1336

Open
Nishuuzz wants to merge 1 commit into
arrow-py:masterfrom
Nishuuzz:fix-sinhala-day-abbreviations
Open

Fix misaligned Sinhala day abbreviations#1336
Nishuuzz wants to merge 1 commit into
arrow-py:masterfrom
Nishuuzz:fix-sinhala-day-abbreviations

Conversation

@Nishuuzz

@Nishuuzz Nishuuzz commented Aug 9, 2026

Copy link
Copy Markdown

The weekday abbreviations in the Sinhala locale don't line up with the days they belong to. From Tuesday onwards they're off by a slot: Tuesday holds Wednesday's abbreviation, Thursday holds Friday's, Friday holds Saturday's, and Tuesday's own one has ended up down in the Saturday slot.

Two things go wrong because of it. Tuesday and Wednesday both come out as බදා, so you can't tell them apart, and Thursday's abbreviation is missing from the table altogether:

>>> import arrow
>>> monday = arrow.Arrow(2026, 3, 9)
>>> [monday.shift(days=i).format("ddd", locale="si") for i in range(7)]
['සදුද', 'බදා', 'බදා', 'සිකු', 'සෙන', 'අ', 'ඉරිදා']

You don't have to read Sinhala to see that's wrong. Each abbreviation is meant to be the beginning of the day name it stands for, which is true for Monday, Wednesday and Sunday, but for Tuesday, Thursday, Friday and Saturday it's the beginning of a different day's name instead.

The fix is mostly just putting the existing entries back with the right days. Thursday was the one that had nothing to move back, so I've added බ්‍රහ, taken from the front of බ්‍රහස්‍පතින්‍දා the same way the others are formed from their day names.

I don't speak Sinhala, so I'd rather be clear about which bit is which. The reordering is mechanical and you can check it against the day names without knowing the language. The Thursday abbreviation is the one real judgement call, and if that isn't how it's normally shortened, tell me and I'll change it.

I also had to update test_weekday. It expected Saturday to abbreviate to , which is actually Tuesday's, so it was written to match the table rather than the language. That's presumably how this survived since the locale was added in #1044. The new test_day_abbreviations pins all seven, checks each one really is the start of its own day name, and checks they're all distinct.

Both tests fail before this change and pass after it. Full suite is green at 1902 passed, and black and flake8 are happy with both files.

One last thing while I was in here: Latvian uses pi for both pirmdiena and piektdiena, and Maltese uses Ħ for both Il-Ħamis and Il-Ħadd. Those are ambiguous rather than out of order, and choosing the right short forms needs someone who speaks the language, so I've left them alone. Happy to open an issue for them if it's worth tracking.

The `day_abbreviations` table for the Sinhala locale is shifted from
Tuesday onward. Tuesday carries Wednesday's abbreviation, Thursday
carries Friday's, Friday carries Saturday's, and Tuesday's own "අ" ends
up in the Saturday slot. As a result Tuesday and Wednesday both render
as "බදා", and Thursday has no abbreviation of its own at all.

Each abbreviation should be a prefix of the day name it labels. That
holds for Monday, Wednesday and Sunday, and fails for the other four,
where the value is a prefix of a neighbouring day's name instead.

Move the existing entries into their correct slots and add the missing
Thursday abbreviation.

`test_weekday` asserted that Saturday abbreviates to "අ", which is
Tuesday's abbreviation. It was written from the table rather than from
the language, so it locked the bug in; it now expects "සෙන".
@codecov

codecov Bot commented Aug 9, 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 (6cec062).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1336   +/-   ##
=========================================
  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