-
Notifications
You must be signed in to change notification settings - Fork 999
Add Catalan localisation support #1590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
the error I’m seeing in |
|
The NET 10.0 SDK stuff should be fixed now |
There was a problem hiding this comment.
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 adds comprehensive Catalan localization support to the Humanizer library, including date/time formatting, number-to-words conversion, ordinal number formatting, and various humanization features. The implementation follows the existing localization patterns in the codebase and provides culturally appropriate Catalan translations.
Key changes:
- Added complete Catalan resource translations for all humanization features
- Implemented Catalan-specific formatters and converters for numbers, dates, and time expressions
- Added comprehensive test coverage for all Catalan localization features
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Humanizer/Properties/Resources.ca.resx | Complete Catalan resource file with translations for all humanization strings |
| src/Humanizer/Localisation/TimeToClockNotation/CaTimeOnlyToClockNotationConverter.cs | Time-to-clock notation converter with Catalan-specific formatting |
| src/Humanizer/Localisation/Ordinalizers/CatalanOrdinalizer.cs | Ordinal number formatter supporting Catalan gender agreements |
| src/Humanizer/Localisation/NumberToWords/CatalanNumberToWordsConverter.cs | Comprehensive number-to-words converter with Catalan grammar rules |
| src/Humanizer/Localisation/Formatters/CatalanFormatter.cs | Main formatter handling gender-specific time unit formatting |
| src/Humanizer/Localisation/DateToOrdinalWords/*.cs | Date-to-ordinal-words converters for both DateTime and DateOnly |
| src/Humanizer/Configuration/*.cs | Registry updates to include Catalan converters and formatters |
| src/Humanizer.Tests/Localisation/ca/*.cs | Comprehensive test suite covering all Catalan localization features |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/Humanizer/Localisation/NumberToWords/CatalanNumberToWordsConverter.cs
Outdated
Show resolved
Hide resolved
src/Humanizer/Localisation/NumberToWords/CatalanNumberToWordsConverter.cs
Show resolved
Hide resolved
src/Humanizer/Localisation/NumberToWords/CatalanNumberToWordsConverter.cs
Show resolved
Hide resolved
| if (thousands == 1) | ||
| thousandPart = "mil"; | ||
| else | ||
| thousandPart = $"{Convert(thousands, gender)} mil"; |
Check notice
Code scanning / CodeQL
Missed ternary opportunity Note
| if (millions == 1) | ||
| millionPart = "un milió"; | ||
| else | ||
| millionPart = $"{Convert(millions, GrammaticalGender.Masculine)} milions"; |
Check notice
Code scanning / CodeQL
Missed ternary opportunity Note
| if (number == 22) return gender == GrammaticalGender.Feminine ? "22a" : "22n"; | ||
| if (number == 31) return gender == GrammaticalGender.Feminine ? "31a" : "31r"; | ||
| if (number == 11 || number == 100 || number == 999) | ||
| return number.ToString() + (gender == GrammaticalGender.Feminine ? "a" : "è"); |
Check notice
Code scanning / CodeQL
Redundant ToString() call Note
| return gender == GrammaticalGender.Feminine ? "999a" : "999è"; | ||
| // Comportamiento genérico | ||
| if (gender == GrammaticalGender.Feminine) | ||
| return number.ToString() + "a"; |
Check notice
Code scanning / CodeQL
Redundant ToString() call Note
| // Comportamiento genérico | ||
| if (gender == GrammaticalGender.Feminine) | ||
| return number.ToString() + "a"; | ||
| return number.ToString() + ( |
Check notice
Code scanning / CodeQL
Redundant ToString() call Note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/Humanizer/Localisation/NumberToWords/CatalanNumberToWordsConverter.cs
Show resolved
Hide resolved
src/Humanizer/Localisation/NumberToWords/CatalanNumberToWordsConverter.cs
Show resolved
Hide resolved
src/Humanizer/Localisation/NumberToWords/CatalanNumberToWordsConverter.cs
Show resolved
Hide resolved
src/Humanizer/Localisation/NumberToWords/CatalanNumberToWordsConverter.cs
Show resolved
Hide resolved
src/Humanizer/Localisation/NumberToWords/CatalanNumberToWordsConverter.cs
Show resolved
Hide resolved
src/Humanizer/Localisation/NumberToWords/CatalanNumberToWordsConverter.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| azure-pipelines.yml = azure-pipelines.yml | ||
| build.cmd = build.cmd | ||
| build.ps1 = build.ps1 | ||
| Humanizer.ruleset = Humanizer.ruleset |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path prefixes were changed from relative paths (starting with '.') to simple filenames. Ensure these files are accessible from the updated paths.
Hi! I’m trying to add Catalan as a new language, but I’m running into some issues just trying to get the bare minimum working.
First, I had to change the
src/Humanizer/TimeSpanHumanizeExtensions.csfile because when compiling on .NET 8 I got this error:Let me know if I should just drop this change, since it probably shouldn’t be happening anyway.
On another note, whenever I try to run
build.cmdorbuild.ps1, I keep getting errors related to Kurdish language. I tried installing it—as suggested in another issue—but no luck.I’m attaching a screenshot showing all tests passing in Visual Studio.