Skip to content

Add six localized cron languages#20

Merged
teesofttech merged 1 commit into
masterfrom
codex/issue-8-add-language-support
Jun 23, 2026
Merged

Add six localized cron languages#20
teesofttech merged 1 commit into
masterfrom
codex/issue-8-add-language-support

Conversation

@teesofttech

@teesofttech teesofttech commented Jun 23, 2026

Copy link
Copy Markdown
Owner

What changed

  • add German (de), Portuguese (pt), Italian (it), Dutch (nl), Simplified Chinese (zh), and Japanese (ja) phrase profiles
  • add full, short, and single-letter day-name mappings for every new locale while preserving custom mappings
  • use locale-appropriate 24-hour time formatting and localized monthly ordinals
  • document all supported language codes in both package and repository READMEs
  • add 36 localization test cases covering intervals, all built-in day-name formats, and monthly schedules

Why

CronCraft previously dispatched only English, Spanish, and French. Requests for the six additional language codes fell back to English phrases and English day names.

Impact

Consumers can now select any requested locale through CronSettings.Language. Existing English, Spanish, and French behavior remains unchanged.

Validation

  • dotnet test CronCraft.sln --no-restore
  • 75 tests passed, 0 failed
  • git diff --check

Closes #8

Summary by CodeRabbit

  • New Features

    • Added localization support for German, Portuguese, Italian, Dutch, Simplified Chinese, and Japanese in cron expression descriptions.
  • Documentation

    • Updated language support documentation with newly added languages.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 36532e64-2b50-45ae-9719-2e9405d5bfbc

📥 Commits

Reviewing files that changed from the base of the PR and between 525173b and 7ba8cfd.

📒 Files selected for processing (6)
  • CronCraft.Test/CronHelperTest.cs
  • CronCraft/Extensions/CronHelper.cs
  • CronCraft/Models/CronSettings.cs
  • CronCraft/Providers/DayNameProvider.cs
  • CronCraft/README.md
  • README.md

📝 Walkthrough

Walkthrough

Adds six new locale support entries (German, Portuguese, Italian, Dutch, Simplified Chinese, Japanese) to CronCraft. Changes span day-name dictionaries in DayNameProvider, phrase dictionaries and language dispatch in CronHelper, language-aware FormatTime/Ordinal/DescribeOrdinals formatting, and data-driven localization tests.

Changes

Multi-language Localization Support

Layer / File(s) Summary
Day-name dictionaries for new languages
CronCraft/Providers/DayNameProvider.cs
CreateDayMap helper generates 0–7 keyed day dictionaries; full, short, and single name arrays for de, pt, it, nl, zh, and ja are defined and registered in the GetDayMap switch.
Phrase dictionaries and language dispatch
CronCraft/Extensions/CronHelper.cs, CronCraft/Models/CronSettings.cs
ToHumanReadable switch gains cases for all six new languages; existing en/es dictionaries gain new phrase keys and TimeFormat; French and all six new language helpers supply complete phrase dictionaries with locale-appropriate TimeFormat; CronSettings.Language XML doc lists all nine supported codes.
Language-aware time and ordinal formatting
CronCraft/Extensions/CronHelper.cs
FormatTime overloads accept a phrases dictionary to select 12h vs 24h output; Ordinal gains a language parameter for locale-specific suffixes; DescribeOrdinals and TryDescribeTimePattern propagate language/phrases through ordinal ranges, hour/minute ranges, and time lists; schedule branches use new phrase keys.
Localization tests and documentation
CronCraft.Test/CronHelperTest.cs, CronCraft/README.md, README.md
Six [DataTestMethod] tests with multiple [DataRow] cases cover cron translation for de, pt, it, nl, zh, and ja across DayNameFormat values; AssertLocalized helper builds CronSettings and calls ToHumanReadable; both README files updated with new language entries.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • teesofttech/CronCraft#14: Modifies CronHelper.ToHumanReadable and FormatTime/TimeZoneInfo handling in CronHelper.cs, which is directly affected by the new phrases-accepting FormatTime overloads introduced in this PR.
  • teesofttech/CronCraft#18: Modifies BuildHumanReadable, TryDescribeTimePattern, and DescribeOrdinals in CronHelper.cs — the same methods that now accept language/phrases parameters for locale-aware formatting in this PR.

Poem

🐇 Six new tongues now join the fold,
Deutsch, Português, and more enrolled,
日本語 and 中文 too in line,
Each cron phrase rendered so divine.
With ordinals tuned to every land,
My paws have typed what schedules planned! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-8-add-language-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@teesofttech teesofttech changed the title [codex] Add six localized cron languages Add six localized cron languages Jun 23, 2026
@teesofttech
teesofttech marked this pull request as ready for review June 23, 2026 05:47
Copilot AI review requested due to automatic review settings June 23, 2026 05:47
@teesofttech
teesofttech merged commit d2b7395 into master Jun 23, 2026
2 of 3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR expands CronCraft’s localization support by adding six new language codes (de, pt, it, nl, zh, ja) so CronSettings.Language can produce localized, human-readable cron descriptions rather than falling back to English.

Changes:

  • Added new locale dispatch branches and phrase dictionaries for German, Portuguese, Italian, Dutch, Simplified Chinese, and Japanese.
  • Added localized day-name mappings (full/short/single) for each new locale in DayNameProvider.
  • Documented supported language codes in both READMEs and added 36 new localization test cases.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
README.md Documents the newly supported language codes at the repository level.
CronCraft/README.md Mirrors the supported language documentation for the package README.
CronCraft/Providers/DayNameProvider.cs Adds day-name maps (full/short/single) for de/pt/it/nl/zh/ja and wires them into GetDayMap.
CronCraft/Models/CronSettings.cs Updates XML docs to list all supported Language values.
CronCraft/Extensions/CronHelper.cs Adds locale dispatch and new phrase dictionaries; updates time formatting and ordinal handling.
CronCraft.Test/CronHelperTest.cs Adds 36 tests validating localized output across intervals, day-name formats, and monthly schedules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -24,6 +24,12 @@ public static string ToHumanReadable(this string cronExpression, CronSettings se
{
Comment on lines 233 to 237
if (dayOfMonth.EndsWith('W'))
{
var baseDay = Ordinal(dayOfMonth.TrimEnd('W'));
var baseDay = Ordinal(dayOfMonth.TrimEnd('W'), settings.Language);
return $"Nearest weekday to the {baseDay} of the month {Phrase("AtTime", time)}";
}
Comment on lines 424 to 426
description =
$"Every hour from {FormatTime(startHour, fixedMinute, timeZone)} to {FormatTime(endHour, fixedMinute, timeZone)}";
$"Every hour from {FormatTime(startHour, fixedMinute, timeZone, phrases)} to {FormatTime(endHour, fixedMinute, timeZone, phrases)}";
return true;
Comment on lines 437 to 439
description =
$"Every minute from {FormatTime(fixedHour, startMinute, timeZone)} to {FormatTime(fixedHour, endMinute, timeZone)}";
$"Every minute from {FormatTime(fixedHour, startMinute, timeZone, phrases)} to {FormatTime(fixedHour, endMinute, timeZone, phrases)}";
return true;
Comment on lines 449 to 453
from parsedMinute in minutes
select FormatTime(parsedHour, parsedMinute, timeZone))
select FormatTime(parsedHour, parsedMinute, timeZone, phrases))
.ToList();

description = $"At {JoinDescriptions(times)}";
Comment on lines 398 to +401
var bounds = part.Split('-', StringSplitOptions.TrimEntries);
return bounds.Length == 2
? $"{Ordinal(bounds[0])} through the {Ordinal(bounds[1])}"
: Ordinal(part);
? $"{Ordinal(bounds[0], language)} through the {Ordinal(bounds[1], language)}"
: Ordinal(part, language);
@github-actions

Copy link
Copy Markdown

🎉 Thank you for your contribution!

This PR was included in CronCraft v1.0.6 and is now live on NuGet for everyone to use. We really appreciate the time and effort you put in — it makes the library better for the whole community! 🚀

dotnet add package CronCraft --version 1.0.6

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.

Add additional language support (German, Portuguese, Italian, Dutch, Chinese, Japanese)

2 participants