简体   繁体   中英

C# localization different in the IDE and real life

My code is prepared for English and German. I have the statement Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("de-DE"); or Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US"); before the InitializeComponent() statement;

It works fine with the initial window including the menu-items coming up in German or English. But only when compiled and run within the IDE. When I publish the project as a ClickOnce-programm, install it as that and run it, then the initial window comes up with German menu-items ALL THE TIME!

Windows 7, VS 2013 Community, .NET 4.0,

My guess is that the English resource files were not copied as part of the published package.

Make sure that the resource files are part of the project. Click on the file and look at the properties. Under the advanced properties, you'll see "Build Action" and it should be set to "Content" (looking at one of my projects now and that's what it says).

Thanks for the tip. Yes, you are right! The "en..."-files weren't published. I checked it thru ProjectName\\Publish\\Application-Files. And the two "en.." - resources were "excluded". (I don't know when that happened because it worked fine before). Anyway, the files are now "included" and everything works great. Harry

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM