How to use them in a ASP.NET Web Application project? Any difference?
many thanks
Local resource is specific to a single Web page and used for providing versions of a Web page in different languages. Local resources must be stored in App_LocalResources sub folder. Local resources must be named in format [. language / language and culture].
If you are creating a global resource file, you must have a folder named App_GlobalResources. To create the folder, in Solution Explorer, right-click the name of your Web site, click Add Folder, and then click App_GlobalResources Folder.
You can use application resource files (. resx) to efficiently create a localizable Microsoft ASP.NET Web application. By using resource files, you can store localized values for controls. The localized values are based on a user's language and culture.
Local Resources:
Ex: Default.aspx.resx- Base resource file. This is the default, or fallback, resource file.
Default.aspx.de.resx- A resource file for German etc.
Global Resources:
Global Resources Localization Suggestion for ASP.NET
Global resource must be stored in App_GlobalResources at the root of the application.
// Get the global resource string. try { globalresourcestring = (String)GetGlobalResourceObject("MyResource", "GlobalResourceString1"); } catch { globalresourcestring = "Could not find global resource."; }
These are the steps for ASP.NET MVC 5 Web Application
ex. <add namespace="ProjectName.App_LocalResources" />
In order to access the local resource file in your html code you must add
@using ProjectName.App_LocalResources
to the top of the page.
You can then access the different resources in the App_LocalResources by using the
@NameOfResxFile.NameOfValueInResxFile
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With