asp.net-corerazorlocalizationsubdirectoryresx

Have resources files in their respective language subdirectory in ASP.NET Core


I want to use this file structure in my ASP.NET Core 6 Razor web app, resource files grouped by language in subfolders:

Resources/
  en/
    Pages/
      Index.resx
      Foobar.resx
    _Layout.resx
  de/
    Pages/
      Index.resx
      Foobar.resx
    _Layout.resx
  ...

Instead of the official way:

Resources/
  Pages/
    Index.en.resx
    Foobar.en.resx
    Index.de.resx
    Foobar.de.resx
  _Layout.en.resx
  _Layout.de.resx

The reason for this is to have a cleaner structure even when having 30+ languages.

I was wondering if it was possible using official services provided. Perhaps there is a library for this purpose?


Solution

  • Ended up having source localization files in a dedicated directory and used the translation platform Crowdin to export to Resources/ the way intended by the documentation.