I was looking over the suggestions on this page Programmatic way to get all the available languages (in satellite assemblies), and decided that this one might fit best:
public IEnumerable<CultureInfo> GetSupportedCulture()
{
//Get all culture
CultureInfo[] culture = CultureInfo.GetCultures(CultureTypes.AllCultures);
//Find the location where application installed.
string exeLocation = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
//Return all culture for which satellite folder found with culture code.
return culture.Where(cultureInfo => Directory.Exists(Path.Combine(exeLocation, cultureInfo.Name)));
}
So, I created a little test method, but I noticed that one of our resource files does not get generated.
For example, here are the .resx files (located in a separate library project):
- (English) LanguageResources.resx
- (French) LanguageResource.fr-FR.resx
- (Spanish) LanguageResource.es-ES.resx
- (Vietnamese) LanguageResource.vn-VN.resx
So when I go to the executing assemblies bin directory, I only see the following folders: es-ES and fr-FR
Inside the folders, of course, is the resources.dll file.
Does anybody know why the vn-VN folder/resources.dll file is not getting created during the build? English is not there either, but I half-expect that since it's our default, and 'en-US' is not included in the LanguageResources.resx file name.
I've checked the .csproj file of the library containing the Resource files - and don't see anything obvious.
I did, however, find this in the build log:
- 1> Culture of "" was assigned to file "LanguageResources\LanguageResource.resx". (TaskId:22)
- 1> Culture of "" was assigned to file "LanguageResources\LanguageResource.vn-VN.resx". (TaskId:22)
and since neither the English or Vietnamese resources.dll files are being produced I thought this might have something to do with it.
Can anybody shed any light on this? and tell me how to correct the issue?