locked
How can I get the localizer in the controller? RRS feed

  • Question

  • User1052024640 posted

    Now I am making a news release system which is a small system(about 5 news pre-year) to release some news of an enterprise. 

    In my opinion, I will use a Controller and a template View to achieve this. The news will only release by editing the source code but not create a brand new heavy release system.

    I create a model like this by storing the context of the news and title of the news:

    public NewsModel{

            public string Title{get;set;}

            public string Context{get;set;}

    }

    Now the problem is there are multi-language of the news, how can I get the localizer to render the Title&Context to the right language in the controller.

    I followed the tutorial of Microsoft to achieve Globalization by using the resoureces:https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-3.0 but I don't know how to solve this.

    Monday, September 9, 2019 3:19 AM

Answers

All replies