Viincenttt / MollieApi

This project allows you to easily add the Mollie payment provider to your application.
MIT License
150 stars 85 forks source link

Localization support #162

Closed cassie113nl closed 4 years ago

cassie113nl commented 4 years ago

Hi, We are translating our asp.net core application to multiple languages. Is it possible to add support for localization as defined in the following link? https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-2.1#dataannotations-localization

Viincenttt commented 4 years ago

Hi whats-it-nl,

It is not possible to decorate the properties of the models within the library with these attributes. The best way to continue forward would be to create your own models and decorate them with these attributes. Then you will have to convert these models to the Mollie API models and pass them to the library API client methods. You can do this manually or use a library like AutoMapper.

The above method is also the approach I took in the Mollie.WebApplicationCoreExample project that you can find in the Git repository. Take a look at these links for some inspiration: https://github.com/Viincenttt/MollieApi/blob/development/Mollie.WebApplicationCoreExample/Models/CreatePaymentModel.cs https://github.com/Viincenttt/MollieApi/blob/development/Mollie.WebApplicationCoreExample/Controllers/PaymentController.cs https://github.com/Viincenttt/MollieApi/blob/development/Mollie.WebApplicationCoreExample/Services/Payment/PaymentStorageClient.cs