WPF Localization in XAML, what is the simple, easy and elegant way of doing it?

后端 未结 5 1155
既然无缘
既然无缘 2021-02-07 10:14

I have a very common question. What is the best way to do localization in a WPF app. Well, I searched in SO and Binged a lot too. But I could not find any pointers which is real

5条回答
  •  独厮守ぢ
    2021-02-07 10:55

    We have an application that can switch UI languages at runtime and has the ability to use new UI languages by copying the appropriate resources to a certain directory. Using some sort of compiled resoures for this is way too inflexible in terms of distributuon etc. So we have our language resources in a ResourceDictionary as System:Strings - one ResourceDictionary in a separate XAML file for each language. The XAML files are tagged as Content in VS and copied. You can use them as DynamicResources in XAML or via a Localizer instance in C#. This concept has proofed very useful in our application.

提交回复
热议问题