Take the 2-minute tour ×

I need to programatically list the available cultures in a resx file group, but the ResourceManager class doesn't seem to help.

I may have :


and so on

However, how can I find these three (or how many would there be) cultures at runtime?

share|improve this question
I don't think you really need .net in the title and have a tag for .net. –  spinon Jul 12 '10 at 8:49
Also just looking through SO this seems like a duplicate to: stackoverflow.com/questions/1283602/… –  spinon Jul 12 '10 at 8:53
Yes, it is a duplicate but this has a better answer –  Sam Mackrill Feb 28 '12 at 16:57
add comment

2 Answers

up vote 4 down vote accepted

Look for satellite assemblies in your application's directory : for each subdirectory, check if it's name corresponds to a culture name, and if it contains a '.resources.dll' file :

public IEnumerable<CultureInfo> GetAvailableCultures()
    var programLocation = Process.GetCurrentProcess().MainModule.FileName;
    var resourceFileName = Path.GetFileNameWithoutExtension(programLocation) + ".resources.dll";
    var rootDir = new DirectoryInfo(Path.GetDirectoryName(programLocation));
    return from c in CultureInfo.GetCultures(CultureTypes.AllCultures)
           join d in rootDir.GetDirectories() on c.IetfLanguageTag equals d.Name
           where d.GetFiles(resourceFileName).Any()
           select c;
share|improve this answer
add comment

There is a more elegant approach described here

share|improve this answer
add comment

Your Answer


