I have designed my MVC application in the following way:
-Portal.UI ( hold all the Views and controllers details)
- App_GlobalResources
- Global.en-GB.resx
- Global.ar-SA.resx
-Portal.Models ( hold all classes and Entity framework DbContext code first)
- Resources
- Global.en-GB.resx
- Global.ar-SA.resx
-Portal.Services ( used for accessing different internal web services)
client requested to make the application multilingual to support different languages
so I have added the resources files to the Portal.UI
and converted the views titles and buttons to use these resources files
Also, I added the resources files to the Portal.Models
project and used the [Display(Name="Name",typeof(Resources.Global)]
for each used property
now how can I tell Project.Models
which resource file to use?
I mean if i changed the culture to ar-SA for example in the Portal.UI
, it will reflected also to the Portal.Models
automatically or I have to write code to achieve this?
any advice would be highly appreciated
Resource files selected according to UICulture (and not Culture). Assuming that Portal.Models project is a part of your deployment and is added as reference to your Portal.UI the only thing that you should do is to set a correct UICulture in your Portal.UI.
Useful link that shows the difference between Culture and UICulture