Skip to content

Fix Chinese descriptions of L-n, #n and trailing spaces - #232

Merged
bradymholt merged 2 commits into
bradymholt:masterfrom
zzoraemon043:fix/zh-day-descriptions
Dec 3, 2026
Merged

bradymholt merged 2 commits into
bradymholt:masterfrom
zzoraemon043:fix/zh-day-descriptions

Conversation

@zzoraemon043

Copy link
Copy Markdown
Contributor

What changed and why

Three day descriptions in zh-Hans and zh-Hant don't read as Chinese:

Expression Before (zh-Hans) After (zh-Hans)
0 0 L-2 * * 在 00:00, 2 这个月的最后一天的前几天 在 00:00, 每月的最后一天的前 2 天
0 0 * * 5#3 在 00:00, 在 第三个星期五 每月 在 00:00, 每月的第三个星期五
0 0 9 * * 1#2,1#4 在 09:00, 在 第二个 和 第四个 星期一 每月 在 09:00, 每月的第二个 和 第四个 星期一
0 0 * * 5L 在 00:00, 每月的最后一个 星期五␠ 在 00:00, 每月的最后一个 星期五
0 0 15W * * 在 00:00, 每月的 最接近 15 号的平日␠ 在 00:00, 每月的 最接近 15 号的平日
  • CommaDaysBeforeTheLastDayOfTheMonth put the number in front of a phrase meaning "the few days before the last day of this month", so the count was detached from 天. It now reads "the N days before the last day of each month", matching CommaOnTheLastDayOfTheMonth (每月的最后一天).
  • For #, CommaOnThe + SpaceX0OfTheMonth put 每月 ("monthly") after the day. Chinese puts the month first, so 每月的 moves into CommaOnThe and SpaceX0OfTheMonth is just {0}, the same split cRonstrue's zh_CN uses (, 限每月的 / %s). The # list suffix is then empty, so lists read the same way.
  • CommaOnTheLastX0OfTheMonth and CommaOnTheX0OfTheMonth ended with a space, which ended up at the end of the description (the existing tests asserted it).

zh-Hant gets the same changes (每月的最後一天的前 N 天, 每月的第三個星期五). I compared 31 locales x 43 expressions before and after: only zh-Hans and zh-Hant output changed, in the L-n, #, L and W descriptions.

Checklist

  • dotnet test test/Test.csproj passes (1636 passed, 11 skipped)
  • Added or updated tests for the change (TestLastDayOffset and TestMultipleNthDayOfWeek added for both locales; the updated and added zh assertions fail before the change, 20 failures)
  • For a new language: added it to the README table, the demo language list and the csproj <Description> (see CONTRIBUTING.md)

@bradymholt bradymholt left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the zh-Hans and zh-Hant output for L-n, LW, L-nW, W, L, # and # lists, alone and mixed with day-of-month, with Verbose on and off. All read correctly and tests pass. I left one small suggestion about the space in the L string.

Comment thread lib/Resources.zh-Hans.resx Outdated
</data>
<data name="CommaOnTheLastX0OfTheMonth" xml:space="preserve">
<value>, 每月的最后一个 {0} </value>
<value>, 每月的最后一个 {0}</value>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With 每月的 now attached to the ordinal, * * * * 5#3 gives "每月的第三个星期五" but * * * * 5L still gives "每月的最后一个 星期五" with a space before the day. I think dropping that space here and in zh-Hant would make the two read the same, with TestLastDayOfTheWeekOfTheMonth updated to match. WDYT?

Suggested change
<value>, 每月的最后一个 {0}</value>
<value>, 每月的最后一个{0}</value>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, done in 5962735 for both zh-Hans and zh-Hant, test updated

@bradymholt
bradymholt merged commit 88e90c9 into bradymholt:master Dec 3, 2026
3 checks passed
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

The changes in PR were just released in 3.9.0 🎉.

zzoraemon043 added a commit to zzoraemon043/zzoraemon043 that referenced this pull request Dec 3, 2026
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.

2 participants