Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Translation of a string in code behind in a localresource file

I created local resource files with VisualStudio (.resx and .fr.resx) for each page. All the text of controls in the .aspx page can be translated now.

But can I also translate strings in my code behind in this loacal resource file? If yes, how can I read the value in code behind out of my local .resx files in my App_LocalResources map?

like image 660
Ben Avatar asked May 02 '11 09:05

Ben


1 Answers

You can try...

Simply call the GetLocalResourceObject method on your current page:

GetLocalResourceObject("yourkey").ToString();

GetGlobalResourceObject("MyGlobalResources", "HelloWorldString").ToString();
like image 135
Muhammad Akhtar Avatar answered Oct 15 '22 19:10

Muhammad Akhtar