Last post Jul 10, 2007 09:31 PM by rstrahl
Jul 10, 2007 07:24 AM|irascian|LINK
I can't get implicit localisation of resource strings, as described in various books and articles on globalisation, to work, even though explicit localisation and accessing the resource strings programmatically works fine. Can anybody offer any clues as
to what I might be doing wrong?
I'm generating the resource file using the VS2005 "Tools -> Generate Local Resource" which automatically creates the required local resource file eg MyPage.resx and generates the required implicit localisation in the source. ie:
but I never get the required resource string back and in Design View (where the contents should automatically be retrieved if I'm reading the articles correctly) all I see is the name of the control.
The problem doesn't seem to be with the resource file itself because an explicit declaration like this works fine:
as does trying to access the resource string programmatically:
string temp2 = this.GetLocalResourceObject("lclErrorNumber2").ToString();
Jul 10, 2007 07:50 AM|TATWORTH|LINK
Re "implicit localisation", which controls are you referring to?
Look at http://www.guysmithferrier.com/ and in particular at Guy Smith's book
Also his presentation http://www.guysmithferrier.com/downloads/teni18n.pdf
The controls are not consistent. If you look in his presentation PDF, there are some tips on what to do to fix the problem.
Jul 10, 2007 08:31 AM|durjan|LINK
Try to use "lclErrorNumber2.Text" in resource file instead of lclErrorNumber2.
If this is a problem..
Jul 10, 2007 09:31 PM|rstrahl|LINK
As somebody else pointed out Implicit resource keys in the resource files themselves have to be of the format ReourcesKey.Property. So your resourcekey should be lcErrorNumber2.Text in the resource file and the meta:resourcekey="lcErrorNumber2". Any properties
that that are localizable can be applied.
The easiest way to make this happen though is to use Generate Local Resources in Visual Studio in the Visual Designer - this will generate the Resource Keys for you in the controls and create them in the resource file so you can somewhat easily see what's
actually localizable on the page.
+++ Rick ---