adding different language strings to a single resource file
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.
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.
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...
精彩评论