Hi,
Gawel wrote:
Hajo,
I have app.js file where I store all my java script functions. I am
wondering how to localize it.
I can create second file like app_de.js and switch these two guys
manually but maybe there is other possibility that allows me preserve
one file?
thanks
Pawel Pabich
The way I do it, I create and register (on the server) a script
containing client-side variables with the strings, which I fetched from
resource files.
Example:
String initializeStrings = "<script type=\"text/javascript\">"
+ "var TEXT_ALERT = \""
+ Utilities.CResourceFactory.GetString( typeof( BrowserPage ), "alert" )
+ "\";"
+ "</script>";
this.RegisterClientScriptBlock( "initializeScript", initializeStrings );
In reality it's a bit more sophisticated than that.
NB: The CResourceFactory is using a ResourceManager to get the actual
string.
I use the same technique to initialize all server-dependant client-side
variables, constants, etc...
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering:
http://www.galasoft-LB.ch
Private/Malaysia:
http://mypage.bluewin.ch/lbugnion
Support children in Calcutta:
http://www.calcutta-espoir.ch