Reputation: 21
I am currently developing a Web API using ASP.NET. The Web API will send a text messages to the customers around the world. I want to implement a localization in my Web API so the text message that will going to send to the customers are based on their language and country. Where do I start to accomplish this? Thanks.
Upvotes: 1
Views: 895
Reputation: 5634
As mentioned, in comments, the question seems to be too broad. There can be many right answers. Here is my attempt to give one perspective on how this issue can be resolved.
From design perspective, I think you need to consider one thing - localization should be implemented in the UI layer, not in API layer.
The UI layer should have localization (resx) files which includes different messages to be shown to the user.
The API should return a special object which has only error code and other error properties but not error message.
The UI layer can then parse the reply to see if there is any error code in API response. If there is, then UI can have logic to convert error code to appropriate resx string based on current culture of the UI application. This resx string then should be displayed to the user.
I hope this helps you.
Upvotes: 2