crauscher
crauscher

Reputation: 6618

Find resource for CultureInfo

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

Is there an easy way?

Upvotes: 1

Views: 2535

Answers (1)

Kaerber
Kaerber

Reputation: 1653

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." );
}

Upvotes: 4

Related Questions