1

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.

2
  • In my project we use resource file for localizations. You can refer this link for use resources file learn.microsoft.com/en-us/previous-versions/fw69ke6f(v=vs.140) Commented Mar 1, 2019 at 4:12
  • Googling Globalazing and localizing .NET applications will bring up a fantastic MSDN article. Voting to close this as too broad Commented Mar 1, 2019 at 4:12

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I'd like to add that localization for the UI should be done in the UI layer. However, if there is data in the backend that is stored in some lookup table and needs localization, too, then the backend should take care of that. Example: list of user roles that you want to have trsanslated into the current user's language.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.