[UWP]清单中的默认语言不起作用 [英] [UWP] Default language in the manifest didn`t work

查看:73
本文介绍了[UWP]清单中的默认语言不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,
我的应用程序支持两种语言"en"和清单中的"pl"清单:

 <资源>

  &NBSP; <资源语言=" zh" />

  &NBSP; <资源语言=" pl" />

  < / Resources>

我选择默认语言"en",但在我更改了语言环境"pl" - "de"之后,我的应用程序仍然以波兰语语言环境启动,而不是英语。  
$
可以使用"默认语言"当我在清单中选择语言时工作,或者只能使用"<资源语言=" x-generate" />"?

Hello,
My application supports two languages "en" and "pl", in the manifest:
 <Resources>
    <Resource Language="en"/>
    <Resource Language="pl"/>
  </Resources>
And I choose Default language "en", but after I changed locale "pl"-"de", my app still launch at Polish locale, not at English. 
Can "Default language" working when I choose languages in the manifest, or It can work only with "<Resource Language="x-generate"/>"?

推荐答案

嗨悲伤小丑,



语言设置有两种情况:

  &NBSP; 1.当您的系统语言为"pl"时你有两种语言"en"和"pl"在你的申请中。无论您为"默认语言"设置什么,您的应用语言都将是"pl"。

  &NBSP; 2.当您的系统语言是其他语言(既不是"en"也不是"pl"),但您设置了"默认语言"。如"en",您的应用语言将为"en"。 

注意 使用默认语言资源如果用户的首选语言或显示语言与应用程序中提供的语言资源不匹配。



同时,如果您想将应用语言更改为" ; en",您可以使用以下代码,或者您可以尝试将系统语言更改为"en":
$
Hi Sad Clown,

There will be two situations for the language settings:
    1. When your system language is "pl" and you have two languages "en" and "pl" in you application. Whatever you set for the "Default language", your app language will be "pl".
    2. When your system language is other language(neither "en" nor "pl"), but you set the "Default language" as "en", your app language will be "en". 
Note The default language resources are used if the user's preferred language or display languages do not match the language resources provided in the application.

Meanwhile if you want to change your app language to "en", you can use the following code or you can try to change your system language to "en":
        private async void ChangeButton_Click(object sender, RoutedEventArgs e)
        {
                var culture = new System.Globalization.CultureInfo("en-US");
                Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = culture.Name;
                Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView().Reset();
                Windows.ApplicationModel.Resources.Core.ResourceContext.GetForViewIndependentUse().Reset();
                await Task.Delay(100);//need to have a delay
                //To refresh the UI without restart the phone
                this.Frame.Navigate(this.GetType());
        }


祝你好运,

Breeze Liu

Best regards,
Breeze Liu


这篇关于[UWP]清单中的默认语言不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆