4

Closed

LocalizeDictionary.Instance and neutral cultures

description

So based on the sample project code and and Amadeus' wonderful "Idiot's Guide" I am starting to test out culture switching in an existing project of mine, basically:

{{ LocalizeDictionary.Instance.Culture = initialCultureInfo; }}

The rub being that in this project my resources are all neutral ones, like ("en") and ("es").

And it looks like your code will only actually change the culture through this method if the culture value is in the cache of specific cultures! Not horrible once you know that, but


Is there another method I haven't found yet that provides for using a neutral culture?
If not, is this a design choice based on some best practice that says to always use specific cultures??

Cheers,

Berryl
    [Test]
    public void Culture_OnEdit_IfCultureIsNotSpecific_NoChange()
    {
        Assert.That(LocalizeDictionary.Instance.Culture, Is.EqualTo(CultureInfo.InvariantCulture));
        LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("en");
        Assert.That(LocalizeDictionary.Instance.Culture, Is.EqualTo(CultureInfo.InvariantCulture));
    }

    [Test]
    public void Culture_OnEdit_IfCultureIsSpecific_ItIsChanged()
    {
        Assert.That(LocalizeDictionary.Instance.Culture, Is.EqualTo(CultureInfo.InvariantCulture));
        var usCulture = CultureInfo.GetCultureInfo("en-US");
        LocalizeDictionary.Instance.Culture = usCulture;
        Assert.That(LocalizeDictionary.Instance.Culture, Is.EqualTo(usCulture));
    }
Closed Oct 17, 2012 at 10:36 AM by MrCircuit
Cannot be reproduced and is working in our tests.

comments

MrCircuit wrote Sep 12, 2012 at 8:34 PM

Hi Berryl,

Sorry for the delay.
Unfortunately, I have to say, that this works in my projects. Could you please provide some simple example project? Thank you in advance.

Best regards,
Uwe