Portable class library and resx localization

痴心易碎 提交于 2019-12-24 17:14:35

问题


I have Portable class library, where I have resx files containing localization strings (Resources.resx, Resources.en.resx, Resources.de.resx ). Then I use this resources in the PCL LocalizationViewModel in this way :

public string SettingsLogin
{
        get { return Resources.Settings_Login; }
}

Language switching code looks like following :

In PCL

CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(lang);
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(lang);
Resources.Culture = new CultureInfo(lang);

In Win8.1 app

Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = lang;

Strings from LocalizationViewModel are consumed in Win8.1 application and it works pretty good, change of the language in the runtime as well.

Problem occurs, when I create App package and install application. When I run installed application, language switch is not working.

In resx files, I use embedded resource build action and I tried all combination of the build action and the "copy to output directory" setting.

Similar project you can find in this article

Do you have any idea what can be the problem?


回答1:


See the image linked below. I ran into the same problem, change the setting to Never and it fixes the problem.



来源:https://stackoverflow.com/questions/25641567/portable-class-library-and-resx-localization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!