Skip to content

Add Somali locale parity - #1782

Merged
clairernovotny merged 1 commit into
mainfrom
feat-so
May 16, 2026
Merged

Add Somali locale parity#1782
clairernovotny merged 1 commit into
mainfrom
feat-so

Conversation

@clairernovotny

Copy link
Copy Markdown
Member

Summary

  • Add Somali (so) locale YAML covering all canonical localized surfaces
  • Add Somali exact-output tests for numbers, parsing, ordinals, dates, clock notation, lists, units, phrases, and compass headings
  • Add Somali rows to locale sweep/theory coverage data

Validation

  • dotnet test tests/Humanizer.SourceGenerators.Tests/Humanizer.SourceGenerators.Tests.csproj --framework net10.0
  • dotnet test tests/Humanizer.Tests/Humanizer.Tests.csproj --framework net10.0
  • dotnet test tests/Humanizer.Tests/Humanizer.Tests.csproj --framework net8.0 (rerun passed after one runner foreground-thread cleanup failure with all tests succeeded)
  • dotnet test tests/Humanizer.Tests/Humanizer.Tests.csproj --framework net11.0
  • dotnet pack src/Humanizer/Humanizer.csproj -c Release -o artifacts/locale-parity-validation
  • dotnet format Humanizer.slnx --verify-no-changes --verbosity diagnostic

Copilot AI review requested due to automatic review settings May 16, 2026 19:51
@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

Release Notes

New Features

  • Added complete Somali language support with comprehensive localization for cardinal and ordinal number formatting, date and time humanization with relative time phrases, calendar month names, compass direction labels, and duration units.
  • Included Somali-specific formatting for collection/list conjunctions, time unit names, and data size units to deliver a fully localized user experience.

Walkthrough

This pull request adds complete Somali locale support to the Humanizer library by introducing a Somali locale configuration file and comprehensive test coverage across shared test matrices and culture-specific test suites.

Changes

Somali Locale Addition

Layer / File(s) Summary
Somali locale configuration
src/Humanizer/Locales/so.yml
Defines complete Somali localization including surfaces, relative date/duration phrases, cardinal and ordinal number word mappings, clock notation templates with day periods, compass direction strings (full and abbreviated), and calendar month names.
Shared locale test data updates
tests/Humanizer.Tests/Localisation/LocaleCoverageData.cs, LocaleFormatterExactTheoryData.cs, LocaleNumberMagnitudeTheoryData.cs, LocaleNumberOverloadTheoryData.cs, LocaleNumberTheoryData.cs, LocalePhraseTheoryData.cs
Inserts Somali test expectations across multiple shared theory data sets covering ordinal dates, clock notation (exact/rounded), relative time, collection humanization, cardinal and ordinal number formatting with word forms and grammatical gender variants, large number magnitudes, and phrase humanization for dates, nulls, and time spans.
Somali-specific functional tests
tests/Humanizer.Tests/Localisation/so/SomaliClockNotationTests.cs, SomaliCompassTests.cs, SomaliDateToOrdinalWordsTests.cs, SomaliListAndUnitTests.cs, SomaliNumberToWordsTests.cs, SomaliOrdinalTests.cs, SomaliPhraseTests.cs
Introduces culture-scoped test classes validating Somali localization across clock notation (exact and rounded), compass directions (full and abbreviated), date ordinal words, list and unit humanization, number-to-words and ordinal conversions (including negative numbers and round-trip parsing), and phrase humanization for relative dates and durations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Humanizr/Humanizer#1748: Adds Gujarati locale by extending the same test-data structures and adding a parallel gu.yml locale file.
  • Humanizr/Humanizer#1766: Adds Mongolian locale by updating shared test matrices (LocaleCoverageData, LocaleFormatterExactTheoryData, number/phrase theory datasets) for a different culture.
  • Humanizr/Humanizer#1742: Adds Amharic locale with identical pattern—YAML locale definition plus updates to shared test-coverage and per-locale test files.

Poem

🐰 A rabbit's ode to Somali

In code, a language starts to grow,
With words in Somali now on show.
From dates to clocks, the compass spins—
A new locale has come to win! 🌍

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add Somali locale parity' accurately and concisely describes the main objective of adding complete Somali locale support across the Humanizer library.
Description check ✅ Passed The description clearly details the changes made: adding Somali YAML locale definitions, exact-output tests, and locale sweep coverage data, with comprehensive validation steps performed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat-so

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

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
tests/Humanizer.Tests/Localisation/so/SomaliNumberToWordsTests.cs (1)

6-6: ⚡ Quick win

Rename private culture field to camelCase.

So is private and should follow camelCase (for example, so) to match repository conventions.

As per coding guidelines: "Naming convention: use camelCase for private fields, PascalCase for public members/constants/static readonly".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Humanizer.Tests/Localisation/so/SomaliNumberToWordsTests.cs` at line 6,
Rename the private static readonly field So to camelCase (so) to follow
private-field naming conventions; update the declaration "static readonly
CultureInfo So" to "static readonly CultureInfo so" and then update all
references in the class/tests (e.g., in SomaliNumberToWordsTests methods) to use
"so" instead of "So".
tests/Humanizer.Tests/Localisation/so/SomaliListAndUnitTests.cs (1)

6-7: ⚡ Quick win

Use camelCase for private static readonly test fields.

Pair and Triple are private fields and should follow camelCase naming (pair, triple) for consistency with repo conventions.

As per coding guidelines: "Naming convention: use camelCase for private fields, PascalCase for public members/constants/static readonly".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Humanizer.Tests/Localisation/so/SomaliListAndUnitTests.cs` around lines
6 - 7, Rename the private static readonly test fields Pair and Triple to use
camelCase (pair, triple) in SomaliListAndUnitTests and update all references
within that file (and any related tests) to the new names; ensure the
declarations (currently "static readonly int[] Pair" and "static readonly int[]
Triple") and every usage in methods/assertions are changed to "pair" and
"triple" respectively to comply with private field naming conventions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/Humanizer.Tests/Localisation/so/SomaliListAndUnitTests.cs`:
- Around line 6-7: Rename the private static readonly test fields Pair and
Triple to use camelCase (pair, triple) in SomaliListAndUnitTests and update all
references within that file (and any related tests) to the new names; ensure the
declarations (currently "static readonly int[] Pair" and "static readonly int[]
Triple") and every usage in methods/assertions are changed to "pair" and
"triple" respectively to comply with private field naming conventions.

In `@tests/Humanizer.Tests/Localisation/so/SomaliNumberToWordsTests.cs`:
- Line 6: Rename the private static readonly field So to camelCase (so) to
follow private-field naming conventions; update the declaration "static readonly
CultureInfo So" to "static readonly CultureInfo so" and then update all
references in the class/tests (e.g., in SomaliNumberToWordsTests methods) to use
"so" instead of "So".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c0d83a6-c917-4d5b-b1c7-84ece76026ed

📥 Commits

Reviewing files that changed from the base of the PR and between 84416b5 and aaa5bac.

📒 Files selected for processing (15)
  • src/Humanizer/Locales/so.yml
  • tests/Humanizer.Tests/Localisation/LocaleCoverageData.cs
  • tests/Humanizer.Tests/Localisation/LocaleFormatterExactTheoryData.cs
  • tests/Humanizer.Tests/Localisation/LocaleNumberMagnitudeTheoryData.cs
  • tests/Humanizer.Tests/Localisation/LocaleNumberOverloadTheoryData.cs
  • tests/Humanizer.Tests/Localisation/LocaleNumberTheoryData.cs
  • tests/Humanizer.Tests/Localisation/LocaleOrdinalizerMatrixData.cs
  • tests/Humanizer.Tests/Localisation/LocalePhraseTheoryData.cs
  • tests/Humanizer.Tests/Localisation/so/SomaliClockNotationTests.cs
  • tests/Humanizer.Tests/Localisation/so/SomaliCompassTests.cs
  • tests/Humanizer.Tests/Localisation/so/SomaliDateToOrdinalWordsTests.cs
  • tests/Humanizer.Tests/Localisation/so/SomaliListAndUnitTests.cs
  • tests/Humanizer.Tests/Localisation/so/SomaliNumberToWordsTests.cs
  • tests/Humanizer.Tests/Localisation/so/SomaliOrdinalTests.cs
  • tests/Humanizer.Tests/Localisation/so/SomaliPhraseTests.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds full Somali (so) locale support to Humanizer by introducing a complete locale YAML profile and aligning the test/coverage matrix so Somali participates in the same “locale parity” validation as other shipped locales.

Changes:

  • Added so.yml implementing Somali list formatting, phrases (relative dates/durations), number-to-words + words-to-number parsing, ordinals, clock notation, compass headings, and calendar month names.
  • Added Somali-specific exact-output tests for key localized surfaces (numbers/parsing, ordinals, dates, clock notation, lists, units, phrases, compass headings).
  • Extended shared locale theory/coverage datasets so Somali is included in locale-sweep completeness testing.

Reviewed changes

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

Show a summary per file
File Description
tests/Humanizer.Tests/Localisation/so/SomaliPhraseTests.cs Adds Somali phrase coverage for relative dates, null-date “never”, durations, and age formatting.
tests/Humanizer.Tests/Localisation/so/SomaliOrdinalTests.cs Validates Somali ordinalization (numeric suffix + ordinal words, including negatives).
tests/Humanizer.Tests/Localisation/so/SomaliNumberToWordsTests.cs Adds Somali number-to-words expectations plus words-to-number round-trips for cardinals/ordinals.
tests/Humanizer.Tests/Localisation/so/SomaliListAndUnitTests.cs Verifies Somali list conjunction rules and localized unit labels/symbols.
tests/Humanizer.Tests/Localisation/so/SomaliDateToOrdinalWordsTests.cs Validates Somali date formatting for ToOrdinalWords (DateTime/DateOnly).
tests/Humanizer.Tests/Localisation/so/SomaliCompassTests.cs Adds Somali compass heading expectations (full + abbreviated).
tests/Humanizer.Tests/Localisation/so/SomaliClockNotationTests.cs Validates Somali TimeOnly.ToClockNotation exact and rounded outputs.
tests/Humanizer.Tests/Localisation/LocalePhraseTheoryData.cs Adds Somali rows for shared phrase theory coverage (date humanize, null-date, duration).
tests/Humanizer.Tests/Localisation/LocaleOrdinalizerMatrixData.cs Adds Somali rows to the ordinalizer matrix (numeric/string, genders, word forms, negatives).
tests/Humanizer.Tests/Localisation/LocaleNumberTheoryData.cs Adds Somali rows for shared number/ordinal expectations and parsing cases.
tests/Humanizer.Tests/Localisation/LocaleNumberOverloadTheoryData.cs Adds Somali rows for overload-based number-to-words parity datasets.
tests/Humanizer.Tests/Localisation/LocaleNumberMagnitudeTheoryData.cs Adds Somali magnitude/extended magnitude expectations and high-range round-trip coverage.
tests/Humanizer.Tests/Localisation/LocaleFormatterExactTheoryData.cs Adds Somali entries for shared formatter exact-output datasets (dates, durations, units, lists, headings).
tests/Humanizer.Tests/Localisation/LocaleCoverageData.cs Adds Somali to locale-coverage expectation datasets (dates, clock notation, lists, ordinals, numbers, parsing).
src/Humanizer/Locales/so.yml Introduces the Somali locale YAML profile covering all canonical localization surfaces.

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

@clairernovotny
clairernovotny merged commit 73e48c8 into main May 16, 2026
12 checks passed
@clairernovotny
clairernovotny deleted the feat-so branch May 16, 2026 20:17
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