Parse Vietnamese dates with zero-padded months (#1297)#1338
Open
gaoflow wants to merge 1 commit into
Open
Conversation
Vietnamese month names like "tháng 09" did not parse: the locale data
only listed the un-padded forms ("tháng 9"), so a zero-padded month fell
through to the generic "tháng" -> month token and produced a wrong
relative date instead of an absolute one.
Add zero-padded aliases ("tháng 0N" / "thg 0N") for months 1-9 in the
supplementary language data and regenerate vi.py. Months 10-12 already
carry two-digit forms.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1338 +/- ##
=======================================
Coverage 97.11% 97.11%
=======================================
Files 235 235
Lines 2909 2909
=======================================
Hits 2825 2825
Misses 84 84 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
AdrianAtZyte
approved these changes
Jun 16, 2026
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.
Fixes #1297.
Vietnamese dates with a zero-padded month such as
21 tháng 09 năm 2025were not parsed as absolute dates. Thevilocale data only listed the un-padded month forms (tháng 9), sotháng 09did not match a month name and fell through to the generictháng-> month token, yielding a wrong relative date:Fix
Add zero-padded month aliases (
tháng 0Nandthg 0N) for months 1-9 in the supplementary language data and regeneratevi.py. Months 10-12 already carry their two-digit forms, so they are untouched.Tests
Added a
test_translationcase (tests/test_languages.py):param("vi", "21 tháng 09 năm 2025", "21 september 2025"). It is RED on the unpadded-only data (translates to21 month 09 2025) and GREEN with the fix. The fulltests/test_languages.pysuite passes (1366 passed).Disclosure: I prepared this fix with AI assistance under my direction; I reviewed and verified the change and the test myself.