Hi..
I have a windows application that can change the language of the application depends on the language preference of the user. My application can switch between chinese(zh-CHS) and english(en-US). I also have a report that also can change the language (hopefully) if user change their language preference in the framework of my application.
I already follow the step provided in this link.
http://technet.microsoft.com/en-us/library/aa964130.aspx
While the code is at http://mhprofessional.com/product.php isbn=0072262397&cat=112&promocode=
Since I want to apply it in windows application and C#, i already modified to make it suitable with my application. I can successfully deploy and view my report if user key in (for testing purpose) the language they want in the report interface.
My problem is, I actually want to retrieve the value automatically from the framework. I try to retrieve the current language from thread.
namespace
Mynamespace.RSLanguage.MultiLanguage{
public class MyReports
{
static ResourceManager LocalizeRM;private
static MyReports()
{
LocalizeRM = new ResourceManager("Mynamespace.RSLanguage.MultiLanguage.MyReports", System.Reflection.Assembly.GetExecutingAssembly());
}
[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Assert, Name = "FullTrust")]
public static string LocalizedString(string stringIdentifier, string language)
{
string getLanguage = ""; try
{
if (language != "")
{
getLanguage = language;
}
else{
Thread.CurrentThread.CurrentUICulture.ToString().Trim();getLanguage =
}
CultureInfo currentCulture = new CultureInfo(getLanguage); return LocalizeRM.GetString(stringIdentifier, currentCulture);
}
catch (System.Exception ex){
return ex.Message;
}
}
::::
}
::::
}
But, the getLanguage value still get the "en-US" from the thread even though user change their language preference to chinese. So, it still deploy the report in english. But if user key in "zh-CHS" into the interface, the report will display the report like correctly.
How can I actually retrieve the current value for the language