0

I have following:

Code in Window's XAML

<Grid>
    <Label Content="{x:Static properties:Resources.Caption}"/>
</Grid>

I have Resources.resx, Resources.cs.resx. In run time text in label is changed according to language on client's machine. I would like to see different localization in Visual Studio during design time.

During my investigation I even changed getter for Caption property in Resources.resx to following:

    public static string Caption {
        get {
            return ResourceManager.GetString("Caption", new CultureInfo("cs-CZ"));
        }
    }

This of course hard-code localization in runtime, but still has no effect in design time. In design time I am still getting original Resources.resx value (I suppose it is result of fallback strategy). It seems that during design time localized resources cannot be accessed and therefore values from default one is used.

I would like to avoid using localization frameworks as WPFLocalizationExtension because I believe there should be some "native" way in Visual Studio.

Is there something I am missing that I am unable to get localized versions of strings in design time?

user2126375
  • 1,594
  • 12
  • 29
  • 1
    It seems that you can't dynamically change the culture when using static binding, as mentioned here: http://stackoverflow.com/a/7439615/981831 – Andrew Stephens Jun 08 '16 at 11:26
  • I found this post too. But I believe that changing dynamically is meant for to be in run time (changed multiple time during application is executed). Reason is that static resource should be evaluated just once. – user2126375 Jun 08 '16 at 11:51

0 Answers0