views:

96

answers:

1

Hi,

I need to determine whether there is a resource file for the given CultureInfo or not.

Is there an easy way?

Regards

+1  A: 

You can use ResourceSet ResourceManager.GetResourceSet( CultureInfo culture, bool createIfNotExists, bool tryParents )

Example:

ResourceManager resman = new ResourceManager();
CultureInfo culinfo = new CultureInfo( "RU-ru" );
if( resman.GetResourceSet( culinfo, false, false ) == null )
{
    Console.WriteLine( "Resource file for culture \"RU-ru\" does not exist." );
}
Kaerber
I've tried the code you provieded but it does not work. Here is some more information about my resource files:I have two resource files definedResources.resx (+ .Designer.cs)Resources.de.resxI use the ResourceManager provided by the Resource-Classresman.GetResourceSet(new CultureInfo("de-DE"), false, false) return null altough I have defined a resource for geman language.Taking a look at the ResourceManager instance showed, that there are three ResourceSets defined:- {en}- {}- {en-US}But there is no ResourceSet for 'de-DE' defined.What am I doing wrong?
crauscher
Hmm, please check that you resource file is compiled into resource dll?
Kaerber