Fix misaligned Sinhala day abbreviations - #1336
Open
Nishuuzz wants to merge 1 commit into
Open
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. |
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.
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: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 newtest_day_abbreviationspins 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
pifor bothpirmdienaandpiektdiena, and Maltese usesĦfor bothIl-ĦamisandIl-Ħ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.