WPF实现多语言切换
WPF实现多语言切换
https://gitee.com/chenheze90/L13_WPFMultipleLanguage
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WPFMultipleLanguage" xmlns:s="clr-namespace:System;assembly=mscorlib"> <s:String x:Key="OK">确认</s:String> <s:String x:Key="Cancle">取消</s:String> </ResourceDictionary>
private void Button_Click(object sender, RoutedEventArgs e) { App.UpdateLanguage("zh-cn"); } private void Button_Click_1(object sender, RoutedEventArgs e) { App.UpdateLanguage("en-us"); }
<Button Content="中文" Click="Button_Click"></Button> <Button Content="英语" Click="Button_Click_1"></Button> <Button Content="{DynamicResource OK}"></Button> <Button Content="{DynamicResource Cancle}"></Button>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib"> <s:String x:Key="OK">Sure</s:String> <s:String x:Key="Cancle">NoSure</s:String> </ResourceDictionary>

浙公网安备 33010602011771号