View previous topic :: View next topic |
Author |
Message |
prayag
Joined: 04 Sep 2009 Posts: 4
|
Posted: Tue Sep 08, 2009 10:39 am Post subject: Custom messages are not picked up |
|
|
Hi!
Our team is currently evaluating Globelizer.NET (Developer Edition) software evaluation copy.
The issue is when we try to convert an entire solution the msgbox strings & exception strings are not being scanned by Sisulizer could you please help in providing us a solution for the same.
==========================
Example Provided below:
1) MsgBox("Problem in reading")
2)Dim R As String = String.Empty
Catch ex As MalformedLineException R = (ex.Message &
"not valid skip") |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Sep 08, 2009 10:53 pm Post subject: |
|
|
That is because the standard way of localizing these type of strings is to add the strings to the application resources and then use the resource eg
1. MsgBox(My.Resources.ProblemReadingMsg)
2.
Code: | Dim R As String = String.Empty
Catch ex As MalformedLineException
R = String.Format(My.Resources.ExceptionMsg, ex.Message)
' where ExceptionMsg is defined in resources as "{0} not valid skip" |
Note that in the second case it is usually better to use string.Format with a placeholder for the message rather than concatenating the strings directly - because in other languages the text may occur in a different order.
Microsoft provide a refactoring tool that assists with changing from hard coded text to resources. You can download it here
Once you have added your programmatic strings to the application resources then Globalizer.NET will scan them. _________________ Infralution Support |
|
Back to top |
|
|
bdejong
Joined: 23 Sep 2009 Posts: 16
|
Posted: Wed Sep 23, 2009 1:37 pm Post subject: |
|
|
I have to also comment on this issue. While Globalizer does a great job at the controls and the preview of the form, it should also pull out the embedded strings in the source code and generate the resource files for them.
This would be a great feature and is common in other solutions. Is this possible??? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Sep 23, 2009 11:29 pm Post subject: |
|
|
This is something we could look at. It may be beneficial for users who are starting to localize an application that was not built with localization in mind. Just automatically converting all strings to resources may not be the way to go however. Some strings are not localizable and shouldn't be in resources. Other strings will probably need refactoring to be suitable for localization. For instance developers who aren't conscious of localization will often write something like:
Code: | string error = "There are " + n.ToString() + " instances running"; |
Where as this really should be refactored as:
Code: | string error = string.Format("There are {0} instances running", n); |
to be suitable for localizing (since different languages have different structures).
This means that the process of preparing your project for localization really involves examining each string. You can do this using Visual Studios Find facility to locate each string and then using the Microsoft resource refactoring tool to convert the strings to resources as you go. _________________ Infralution Support |
|
Back to top |
|
|
|