2

I have resource files for languages named as Resource.en-US.resx, Resource.en-GB.resx, Resource.en.resx, Resource.es-ES.resx, Resource.es-MX.resx, Resource.es.resx, Resource.resx ->English

When I give the CultureInfo for language code es-ES I get the correct translation. But when I send es-US I get English. But I want the resource file Resource.es.resx to be chosen if the current culture resource file is not present.

 CultureInfo cul = CultureInfo.CreateSpecificCulture("es-US");
    //Parent shows es
    var parent = cul.Parent;
    ResourceManager   res_man = new ResourceManager("Resources.Resource",typeof(Resources.Resource).Assembly);
    var str = res_man.GetString("Hello", cul);

Output -> Hello

Expected -> Hola

dbc
  • 104,963
  • 20
  • 228
  • 340
  • I tested your code and it works perfectly already, I get "Hola" even for `es-CH` – Francesco B. Apr 15 '18 at 14:54
  • The same code seems to work in a new console application with referencing the same project Resources. But in the application where its actually being used is not working. Am i missing any config level changes thats being overridden or to be checked – Harshitha S Apr 16 '18 at 10:03
  • Maybe. Can you post the config file for your application? If you can't post it fully, at least the `` branch? – Francesco B. Apr 16 '18 at 10:42

0 Answers0