private static List<string> GetAvailableLangsFromSatelliteDlls()
{
List<string> rgsLangs = new List<string>();
// Get the folder in which the program file is stored.
string sDllLocation = Path.GetDirectoryName(Application.ExecutablePath);
// Get all the sub-folders in the program file's folder.
string[] rgsDirs = Directory.GetDirectories(sDllLocation);
// Go through each sub-folder and if at least one file in a sub-folder ends
// with ".resource.dll", we know the folder stores localized resources and the
// name of the folder is the culture ID for which the resources apply. The
// name of the folder is stripped from the path and used to add a language
// to the list.
foreach (string dir in rgsDirs.Where(dir => Directory.GetFiles(dir, "*.resources.dll").Length > 0))
{
var locale = Path.GetFileName(dir);
rgsLangs.Add(locale);
}
return rgsLangs;
}