我正在开发一个多语言(阿拉伯语和英语)的WPF应用程序,使用两个不同的文件进行资源管理(Resources.en-GB和Resources.ar-LY)。我在app.xaml中声明了一个新的方法。
public void LanguageSwitcher(string _currentUICulture)
{
System.Threading.Thread.CurrentThread.CurrentUICulture =
new System.Globalization.CultureInfo(_currentUICulture);
}
在
MainWindow
中,在InitializeComponent
之后,我放置了以下内容:((App)Application.Current).languageSwitcher("ar-LY");
this.FlowDirection =
CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft ?
FlowDirection.RightToLeft :
FlowDirection.LeftToRight;
在语言切换按钮中,我调用该方法并传递我想要的en-GB文化。
((App)Application.Current).languageSwitcher("en-GB");
问题:当我点击语言按钮将UI更改为英语时,文化(culture)发生了变化,窗口流向也变成了从左到右但是文字并没有改变,看起来Resources.en-GB没有加载!
我错过了什么?!