locked
Multilang ressource change RRS feed

  • Question

  • User-553728724 posted

    Hi,

    I look to have futher langages in my MVC asp.net application. I finally use resources.

    I created two files Main.resx and Main.fr.resx in folder Ressources->View

    My website works fine on Main.resx but when I try to change on fr file, it doesn't works. To change I do this:

    Thanks for your help

    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("fr")
    Wednesday, May 27, 2020 8:26 AM

Answers

  • User753101303 posted

    Hi,

    And you are doing this when ? If not done already try to move that to the BeginRequest event in global.asax.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 27, 2020 9:21 AM
  • User753101303 posted

    Resources files are usually compiled. If one time you could recompile just those DLLs and deploy them again. Else you should be able to disable resx files precompilation so that you can deploy them on the server (still it will be compiled on the web server and the app restarts).

    Or if it could be done at any time you could use http://blog.spoorthis.com/2019/04/26/adding-a-custom-resource-provider-for-your-asp-net-application/ to fully customize from where those resources are loaded (for example cached from database tables).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 28, 2020 10:41 AM

All replies

  • User753101303 posted

    Hi,

    And you are doing this when ? If not done already try to move that to the BeginRequest event in global.asax.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 27, 2020 9:21 AM
  • User-553728724 posted

    Thanks, works fine. One more question. Is it possible to copy theses ressources files somewhere in dynmaic without generate again website. I want customer take the english file, translate it and copy it somewhere.

    I hope i'm clear ;)

    Thursday, May 28, 2020 9:27 AM
  • User753101303 posted

    Resources files are usually compiled. If one time you could recompile just those DLLs and deploy them again. Else you should be able to disable resx files precompilation so that you can deploy them on the server (still it will be compiled on the web server and the app restarts).

    Or if it could be done at any time you could use http://blog.spoorthis.com/2019/04/26/adding-a-custom-resource-provider-for-your-asp-net-application/ to fully customize from where those resources are loaded (for example cached from database tables).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 28, 2020 10:41 AM
  • User-553728724 posted

    Thanks a lot

    Thursday, May 28, 2020 1:15 PM