what i'm trying to do is to write a method in c# codebehind to read text based on key.
For now i whant to do this for only one language that's why i don't need to use System.Globalization.CultureInfo
private ResourceManager rm;
private ResourceReader rr;
public string GetCurrentLanguage(string key)
{
rm = new ResourceManager("~/App_GlobalResources/textFile", System.Reflection.Assembly.GetExecutingAssembly());
string result = rm.GetString(key).ToString();
return result;
}
but it doesn't work :(
when i write something like litWelcome.Text = GetCurrentLanguage("Welcome");
it's returns error.
anyone have idea what's i'm doing wrong ?
Thanks for advance:)
Edited
ok i get it on my own this is a solution for my problem:
public string GetCurrentLanguage(string key)
{
string result = Resources.textFile.ResourceManager.GetString(key).ToString();
return result;
}
Thanks all for help:)
Might you be looking for Using Resources for Localization?
I know this isn't a direct answer to your question, but maybe it is the solution you are looking for. This link will give you information on how to use built-in support for localization of your web site in ASP.NET.