Ive been using C#s (Visual Studios) resourcing mechanism and its worked nicely. I have a need to be able to use resources but instead of using CultureInfo as the determinator use something else. This is my current setup which works fine however I have to workout which Resource Manager to use. Either Brussels or Paris. The Resource Manager then works out which resource to use within Brussels or Paris to invoke. What I want is one resource manager for both, so I dont need to decide which resource manager to use. Part of the problem is the PublicResXFileCodeGenerator Custom Tool generates the code for you (which is very nice if you use the standard approach)
This is what it currently looks like (This is working fine)
Brussels Resources
- 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 dont want to use the CultureInfo but instead specify my own resx identifier. Is there a way to do this using resx file?
etc
Brussels and Paris Resources
- MyResourceManager.brussels-en-GB.resx
- MyResourceManager.brussels-ja-JP.resx
- MyResourceManager.brussels-fr-FR.resx
- MyResourceManager.paris-en-GB.resx
- MyResourceManager.paris-ja-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 of
brussels.Header
paris.Header
An example of a similar problem but solved through Custom Cultures can be found here. How to load different RESX files based on some parameter I dont want to do this however as installing cultures on different machines is not an option.
A . resx file contains a standard set of header information that describes the format of the resource entries, and specifies the versioning information for the XML code that parses the data. These files contain all the strings, labels, captions, and titles for all text in the three IBM Cognos Office components.
resx) files are a monolingual file format used in Microsoft . Net Applications. The . resx resource file format consists of XML entries, which specify objects and strings inside XML tags.
The . resx file contains resources. Like the image you assigned to the form's BackgroundImage property. The Windows Forms application template creates a default start-up form that always has a . resx file, although that's unnecessary because it doesn't contain any resources yet.
Use CultureInfo to determine the resource set to load, it will be easier since it integrates into the Thread.CurrentUICulture.
If you have cultures that are not standard out of the box supported cultures, use CultureAndRegionInfoBuilder to build any additional cultures that you need. See http://msdn.microsoft.com/en-us/library/system.globalization.cultureandregioninfobuilder.aspx. There should be ample StackOverflow examples of using this API, i.e. Create custom culture in ASP.NET.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With