views:

141

answers:

2

Hey all.

I have a small application, which includes a resource (.resx) file.

This file contains an icon, and a string, which is used by another application. The icon will be displayed on a button, and the string is the mouseover text.

What I want is in some way, to add strings in multiple languages, without having to crate additional .resx files.

Is there any way to do this?

I am writing my application in C#, and I would like to keep it in the .Net environment, and keep the resource managed.

Any help is appreciated - thanks in advance.

A: 

This would be an abuse of the way localization works in .net. It is meant to work like that - you create a resource file AND localized resource files containing .languageid. in the middle.

Of course, you can code your own "reader" method which appends some prefix to the resource name and then save several values in your file (for instance lv-formtitle, en-formtitle, ru-formtitle etc) , but - why?

If the problem is you do not want to copy the icon to several resource files - make 2 resources, one for icons, other for strings. Localize only the one containing strings.

naivists
Thanks for the reply. I guess I will go with making two resource files.
Sagi1981
A: 

Of course you can add more strings to your resource file, but they will have to have a different name and managed in your application that way (for example - "title" and "title-he") .

Doing this however, defeats the point of resource files.

You should use additional resource files, one per locale, even though you don't want to...

Oded
I can understand that several resource files is the way to go - and why go against best practise ;)Thanks a lot for replying all of you :)
Sagi1981