How to: Localize Code
Unlocalized code uses hard-coded string values. To localize code strings, replace them with calls to GetGlobalResourceObject, which is a method that references localized resources.
To localize code
In Solution Explorer, open the shortcut menu for a project item, and then choose Add, Module.
Choose the Resources File template.
Be sure to add the resource file to a SharePoint project item so that the Deployment Type property is available. This property is required later in this procedure.
Give the default language resource file a name of your choice appended with a .resx extension, such as MyAppResources.resx.
Repeat steps 1 and 2 to add separate resource files to the SharePoint project item: one for each localized language.
Use the same base name for each localized resource file, but add the culture ID. For example, name a German localized resource MyAppResources.de-DE.resx.
Open each resource file and add localized strings. Use the same string IDs in each file.
Change the value of the Deployment Type property of each resource file to AppGlobalResource to cause each file to deploy to the server's App_GlobalResources folder.
Leave the value of the Build Action property of each file as Embedded Resource.
Embedded resources are compiled into the project's DLL.
Build the project to create the resource satellite DLLs.
In the Package Designer, choose the Advanced tab, and then add the satellite assembly.
In the Location box, prepend a culture ID folder to the Location path, such as de-DE\Project Item Name.resources.dll.
If your solution does not already reference the System.Web assembly, add a reference to it, and add a directive in your code to System.Web.
Locate all hard-coded strings in your code that are visible to users, such as UI text, errors, and message text. Replace them with a call to the GetGlobalResourceObject method using the following syntax:
HttpContext.GetGlobalResourceObject("Resource File Name", "String ID")
Choose the F5 key to build and run the application.
In SharePoint, change the display language from the default.
The localized strings appear in the application. To display localized resources, the SharePoint server must have a language pack installed that matches the resource file's culture.