CultureInfo and (resx) resource files

I used the C # s resource engine (Visual Studios) and it worked well. I need to be able to use resources, but instead of using CultureInfo, as the determinant uses something else. This is my current setup, which works great, but I need to figure out which Resource Manager to use. Either in Brussels or in Paris. The Resource Manager then develops which resource to use in Brussels or Paris for the call. I want one resource manager for both, so I don’t have to decide which resource manager to use. Part of the problem is PublicResXFileCodeGenerator . A custom tool generates code for you (which is very good if you use the standard approach)

This is what it looks like now (it works fine)

Resources in Brussels

  • brussels.en-GB.resx
  • brussels.ja-JP.resx
  • brussels.fr-FR.resx
  • brussels.resx

Paris

  • paris.en-GB.resx
  • paris.ja-JP.resx
  • paris.fr-FR.resx
  • paris.resx

I do not want to use CultureInfo, but instead I will specify my own resx identifier. Is there a way to do this with a resx file?

etc.

Brussels and Resources in Paris

  • MyResourceManager.brussels-en-GB.resx
  • MyResourceManager.brussels-i-JP.resx
  • MyResourceManager.brussels-fr-FR.resx
  • MyResourceManager.paris-en-GB.resx
  • MyResourceManager.paris-i-JP.resx
  • MyResourceManager.paris-fr-FR.resx
  • MyResourceManager.resx

EDIT: An example of how I would like to use it (or something similar)

MyResourceManager.Header

instead

brussels.Header

paris.Header

An example of a similar problem, but solved with the help of Custom Cultures, can be found here. How to download various RESX files based on some parameter I don’t want to do this, however, installing cultures on different machines is not an option.

+7
source share
1 answer

Use CultureInfo to determine the loadable resource, this will be easier as it integrates into Thread.CurrentUICulture .

If you have cultures that are not standard for supported crops, use CultureAndRegionInfoBuilder to create any additional crops that you need. See http://msdn.microsoft.com/en-us/library/system.globalization.cultureandregioninfobuilder.aspx . There should be enough StackOverflow examples to use this API, i.e. Create a custom culture in ASP.NET .

+1
source

All Articles