This repository was archived by the owner on May 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Add French translation #17
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededtranslationMessage translationsMessage translations
Description
Feature description
- French translation for the default Validot's message set.
- Placeholders support where applicable.
- Fluent api extension method to
ValidatorSettingsso it can be nicely used fromValidator.Factory.Create.
Feature in action
var validator = Validator.Factory.Create(
specification,
s => s.WithFrenchTranslation()
);
validator.Settings.Translations["French"] // this is the full translation dictionary
validator.Validate(model).ToString(translationName: "French") // gets result error output in FrenchFeature implementation walkthrough
- In Validot, even English language is implemented as a translation that maps the property names from
MessageKeyclass to the human-readable phrases. - Take a look at the files in src/Validot/Translations directory and see how the other languages are implemented.
- In the project's root directory execute
pwsh build.ps1 --target AddTranslation --translationName French - There is also
build.shif you don't have pwsh installed. - You'll notice a the new directory inside src/Validot/Translations that contains two files.
- Open
FrenchTranslation.csand translate the English phrases. - Unit tests are in the related directory tests/Validot.Tests.Unit/Translations, but you don't need to do anything there.
- Their role is to check whether the translation dictionary contains only the keys from the
MessageKeyclass. - You don't need to include all keys translated, but if you want to skip something, please comment the line out instead of removing it (later it would be easier to check what's missing).
- Their role is to check whether the translation dictionary contains only the keys from the
- Done! Now you can make a PR! Thank you for your contribution!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededtranslationMessage translationsMessage translations