Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu May 26, 2011 8:50 am Post subject: How do I localize hard coded strings? |
|
|
How do I localize strings in my code like:
Code: | Dim strMsg as String = "Remember to save before entering more text!"
MessageBox.Show(strMsg) |
Globalizer scans .NET resources it doesn’t scan strings that are just defined in code like this. What you need to do is to first convert them to into resource strings. You add the string to the Project resources then change your code to refer to the resource eg
Code: | MessageBox.Show(My.Resources.SaveMsg) |
This is standard practice for localizing .NET apps. Fortunately there are some tools that make changing existing code to use resources easier. A free “Resource Refactoring Tool” is available from Microsoft for VS2005, VS2008 and VS2010 that allows you to right click on a string in code and move it into a resource.
You can download the tool for VS 2008 here and for VS 2010 here _________________ Infralution Support |
|