Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resource files and linking

Status
Not open for further replies.

mrdance

Programmer
Apr 17, 2001
308
SE
I am new to resourcefiles. I have created two .resx files with strings, the names of these files are:

us-en.resx
se-sv.resx

Now I want to read those strings. The files are in a folder called "lang".

I try to write the following:

dim rm as new ResourceManager("us-en.resx", Assembly.GetExecutingAssembly());
MessageBox.Show(rm.GetString("testname"));

I get an error that it tries to locate a file called us-en.resx.resources and it says me to check if it's correctly linked to the assembly. Why does it add ".resources" and how do I link to my file?

thanks

--- neteject.com - Internet Solutions ---
 
Your folder must have the same name as the culture code.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
I find that strange, what if I won't store language information, but something else?

I also found it strange that whatever I name the file to it added ".resources" to the file when it tried to search for it.

thanks,

Henrik

--- neteject.com - Internet Solutions ---
 
Icons & bitmaps are also localizable, and should be. The classic case is a symbol for "email". Here in the US we have metal boxes out by the street with little red flags on them (the design is standardized by the USPS). In Europe, they have no clue what an icon that looked like that would mean, since their postboxes are attached to the house adjacent to the front door.

The difference is that "de-CH" is not a language code, but a culture code indicating the German-speaking part of Switzerland. It's for those people who speak German (string sorting & collation) who live in Switzerland (icons of envelopes instead of mailboxes, use the metric system, use Swiss Francs, etc.)

If you have the MSDN library installed, paste this link into it's URL box. You can also paste it into IE (but not Firefox). This topic covers the packaging & deployment of resources.

ms-help://MS.MSDNQTR.2005JAN.1033/cpguide/html/cpconPackagingDeployingResources.htm

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
ok, thanks, it worked when I had set the culture and moved the resx files to the root.

But what about this line:

dim rm as new ResourceManager("mynamespace.lang", typeof(mynamespace.LangAPI).Assembly);

If I want to keep all the files in a folder called language, how do I write then?

--- neteject.com - Internet Solutions ---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top