Identifying a default specific CultureInfo from a generic one

Viewed 42

I'm writing a localization resource manager. Sometimes I'm given a culture-specific set of resources (like it-IT, or nl-NL), but I have not a set for the associated generic culture (it).

What I'm doing is that I'm using the specific culture even in case the client (usually a browser) is requesting a generic culture (i.e. if the client asks for it I'm going to serve it the it-IT resources).

Now, I'm trying to understand what could be the strategy to handle a case in which I have multiple specific cultures for the same generic one:

  • nl-NL
  • nl-BE

I'm given both, but I have no set for nl. So, what should I return to clients asking for nl? If I had to manually pick a culture, I would pick nl-NL, and this would be the same for other common cases like fr-FR and de-DE, but I wonder if there could be an heuristic to handle more cases other than "the language part is equal to the country part" (which is the dumb "rule" I'm stuck with at the moment).

Now, I know this is a hard problem in the general case, and I'm not trying to solve "the general case". I want to understand if there is some way to resolve a "DefaultSpecific" culture from a generic CultureInfo instance.

In a very naive and imprecise way, I would like something like the functional opposite of the CultureInfo.Parent property.

0 Answers
Related