Using ASP.NET MVC Razor, I have a resource file in App_GlobalResources
named General.resx
and General.fr.resx
with a name value pairings of "Hello" and "Hello" and "Hello" and "Bonjour".
How do I reference these from my view?
These do not work:
@Html.Resource("General.Hello")
@Html.Resource("GlobalResources.Hello")
@Html.Resource("GlobalResources.General.Hello")
@Html.Resource("GlobalResources, General.Hello")
Try this,
syntax: Resources.[ResourceName].[Property]
To access value from resoure file in view
Add this name space
Then display the value like this
This method is used when evironment culture thread is used.
you need to refer to your namespace:
You can do this in an easier way by adding namespace to /Views/Web.config file In section with namespaces add section below:
Then you can use resources without namespace, like in the example: