473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Problem in Accessing Resource Manager

Hi,
I am developing a windows application which should support different
language for this I am using "Resource Manager" default in .net
framework.

Here I am developing dll for Resource because there are different
application which can access one dll avoid duplications.

Resource File Name :
Resources/MyAppResource.de.resx
Resources/MyAppResource.ja.resx
Resources/MyAppResource.en.resx
Resources/MyAppResource.fr.resx

But here I am facing a big problem.
I created Resource files for four languages as above,
1] Here It is allowing me to use only two letter only if I use ja-JP
the resource manager is not loading the resource set.
2] I am able to access resource strings through "ResourceSet" objects
only, If I create Resource Manager for each language try to access.

3] I am able to access only through the ResourceSet only.


# # # # # # # # # # #

private void button2_Click(object sender, System.EventArgs e)
{
CultureInfo m_EnglishCulture = new CultureInfo("en-US");
CultureInfo m_JapanishCulture = new CultureInfo("ja-JP");
CultureInfo m_FranceCulture = new CultureInfo("fr-CA");
CultureInfo m_DeutchCulture = new CultureInfo("de-AT");

textBox1.Text += Environment.NewLine ;

textBox1.Text += GetString("frmbtn",m_EnglishCulture ) +
Environment.NewLine;
textBox1.Text += GetString("frmbtn", m_JapanishCulture)+
Environment.NewLine;
textBox1.Text += GetString("frmbtn", m_FranceCulture) +
Environment.NewLine;
textBox1.Text += GetString("frmbtn",m_DeutchCulture ) +
Environment.NewLine;

}

private Hashtable m_htResource = new Hashtable();
ResourceManager rm ;

private string GetString(string Key, CultureInfo cinfo)
{
string strCulutre = cinfo.TwoLetterISOLanguageName;;
string strReturnValue ="";
if( m_htResource.Contains(strCulutre) )
{
strReturnValue = ((ResourceSet)
m_htResource[strCulutre]).GetString(Key, true);
//strReturnValue =
((ResourceManager)m_htResource[strCulutre]).GetString(key, cinfo); //
Resourcemanger
}
return strReturnValue;
}
private void LoadAllResources()
{
if( rm == null)
{
rm = new ResourceManager("MyAppResource.Resources.MyAppReso urce",
Assembly.GetExecutingAssembly());
}
string[] strAssemblies = {"en-US", "ja-JP", "de-AT", "fr-CA"};
CultureInfo c ;
foreach(string s in strAssemblies)
{
c = new CultureInfo(s);
ResourceSet rSet = rm.GetResourceSet(c, true,true);
m_htResource.Add(s, rSet); //en-US

if( s.Split('-').Length 1)
m_htResource.Add(s.Split('-')[0], rSet); // en

//ResourceManager rm1 = new
ResourceManager("MyAppResource.Resources.MyAppReso urce",
Assembly.GetExecutingAssembly());
m_htResource.Add(s, rm1);
}
}

private void TestForm_Load(object sender, System.EventArgs e)
{
LoadAllResources();
}

Jul 25 '07 #1
0 1748

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jaydeep | last post by:
Hello, I am facing a strange problem. Problem accessing remote database from ASP using COM+ server application having VB components (ActiveX DLL) installed. Tier 1 : ASP front End (IIS 5.0) Tire...
3
by: Jagdip Singh | last post by:
Hi, We are facing problem accessing to DB2. Seems like database manager is down I tried starting it using db2start but it was neither showing any messages nor returning to command prompt...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
2
by: Rob Garfoot | last post by:
I'm hoping someone here can help with this one as I've been looking all around for a solution to this and I've yet to find one that is satisfactory. I'm trying to add support for different...
5
by: Martin Bischoff | last post by:
Hi, is it possible to implement custom resource managers for ASP.NET 2.0 so that strings can be read from a database (for example)? Ideally, it should be possible to configure the custom...
2
by: Fredrik Rodin | last post by:
All, I'm having problems with my resource manager in ASP.NET 2.0 after conversion from ASP.NET 1.1. Here is a background: In ASP.NET 1.1 All my user controls and aspx pages inherit from...
9
by: Alf P. Steinbach | last post by:
<what to design a C++ solution for> A Windows API /resource/ is data embedded in the executable, accessed via API functions. A resource is completely identified by the quadruple (id, type,...
1
by: Tom | last post by:
This may seem a little strange, but in all my years of developing Windows Forms apps, I've never really used Resource files; however, I would like to start doing so in order to store icons,...
0
harshadd
by: harshadd | last post by:
Dear all, I am trying to install File server Resource Manager to apply user level directory quota. Tried to use this link for help , it is as below: I checked the GIF file But on my...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.