ASP.NET Monsters #75: Internationalization Part 1 - Localizing Text

Play ASP.NET Monsters #75: Internationalization Part 1 - Localizing Text

The Discussion

  • User profile image

    Nice, but we want books

  • User profile image
  • User profile image


    Nice episode.

    I'm wondering if there is a way to get / read all these localizations/translations programatically. For instance something like GetAllLocalizedStrings(..) or GetLocalizedStringsForCulture(..). I guess they abstracted that away in .net core. Could you mash on that? :)

  • User profile image

    @memetolsen:IStringLocalizer has a method GetAllStrings

  • User profile image

    So in case any poor solve is watching this and have the same problem as me that the Controller .resx wasn't read try using the namespace of the controller in the name of the file.

    For example:

    I had:

    namespace example.Controllers
    public class HomepageController : Controller

    And the name of my file was:


    And it wasn't working :( What I did was to put a breakpoint where:

    ViewData["Message"] = _stringLocalizer["welcome-msg"];

    _stringLocalizer was being used, then I checked the variable in the debug, in this case (VS Code) was something like.

    _stringLocalizer > Non-Public members > _localizer > Non-Public members > _resourceBaseName

    And bingo! _resourceBaseName had the name that the file should have :) it said something like this:


    I just renamed to example.Controllers.HomepageController.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.