I try to make my application multilingual. For this I have created two resource files:
- Resource.de-DE.resx
- Resource.en-US.resx
Both are set to public and contain the same keyword and translation. I can also access the keywords in the backend -> see image. Unfortunately my program does not load the files when I change the language.
My steps:
- set the default Resources.resx to public.
- copied this file twice
- renamed file to (see above)
- keywords+translation entered and checked
- project created again
- included on the Button-Content by:
<Button x:Name="Home_Button" Style="{DynamicResource Menuebutton}" Content="{x:Static p:Resources.Menue_home}" Click="Home_Click"/>
- access of the object set by:
xmlns:p="clr-namespace:VS_Launcher.Properties"
- include in the MainWindow.xaml.cs by:
CultureInfo myCultureInfo = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentCulture = myCultureInfo;
CultureInfo.DefaultThreadCurrentUICulture = myCultureInfo;
Thread.CurrentThread.CurrentCulture = myCultureInfo;
Thread.CurrentThread.CurrentUICulture = myCultureInfo;
In another project I did the same thing. But there the solution worked. What is my error?
Resource FilesDirectory structure
1条答案
按热度按时间e3bfsja21#
您确定替代语言资源(不包括文化特性区域设置)的文件名称与预设的文件名称相同吗?如果预设的文件名称是Resource
s
.resx,则替代的文件名称必须是:s
.取消DE.resxs
.en-US.resx