Open hishamco opened 4 years ago
It would be a really weird enhancement in the PoExtractor.
As you explain here: https://github.com/OrchardCMS/OrchardCore/pull/4675#issuecomment-597786219
You are expecting this kind of string to localize:
#. msgid "The UserName field is required."
So you will be looking for the class properties that have a Required
attribute and generate the corresponding string.
Another example in the Account viewModels has a property named 'CurrentPassword', so you would generate:
#. msgid "The CurrentPassword field is required."
which is not correct in English.
I prefer to localize all validation messages by implementing IValidatableObject as I did in #5692
May be a compromise would be to specify the ErrorMessage parameter when you use the Required attribute and generate .po strings only for those ones. https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.requiredattribute
. msgid "The UserName field is required."
This will be generated if the ErrorMessage
contains "The UserName field is required.", otherwise will use the default error message unless you override it in a PO file
So nothing weird here, it will use the same extract mechanism that we 're used, all other translations will be done via Crowdin
As #4675 supports data annotations for PO, it would be nice if we let the
PoExtractor
extract the localization strings fromErrorMessage
property, coz now we are limited to ensure that all the error messages are located in{culture}.po
I can work on this in the
PoExtractor
repository if sound looks good to you guys/cc @agriffard @jtkech @Skrypt @sebastienros