Ben
Ben

Reputation: 207

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?

Upvotes: 7

Views: 3600

Answers (1)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

You can try...

Simply call the GetLocalResourceObject method on your current page:

GetLocalResourceObject("yourkey").ToString();

GetGlobalResourceObject("MyGlobalResources", "HelloWorldString").ToString();

Upvotes: 7

Related Questions