0

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?

codenewbie
  • 181
  • 16

1 Answers1

0

Sorry,

Actually, with some further digging (apologies, I should have done this before posting) - I found that my System.Globalization.CultureInfo list does not contain a definition for vn-VN.
So then I looked at lists of locales and see mostly only vi-VN, but this post says vn-VN String.Format consider locale or not? is valid.

The bottom line is that the reason the folder and resource file are not showing up on my machine is because the culture is not supported.

Once I changed the filename to use vi-VN instead - it worked.

Does anybody know if vn-VN was ever valid? or still is?

Thanks!

codenewbie
  • 181
  • 16