UWP:语言的资源文件未正确部署
UWP: Resource file for languages is not deployed correctly
我的 Universal-Windows-App 有问题:我让用户可以选择更改应用程序的语言。
为此,我为每种语言创建了一个 "Ressources.resw" 文件,我的 XAML 代码通过 x:UID=
部分引用资源。通过 primaryLanguageOverride 更改语言
这在我的环境中工作正常。但是,如果我通过 Store->Create App Packages
部署应用程序,然后尝试在(不同的)Windows-10 台机器上加载应用程序,则语言更改不会正确反映。例如,日期格式正在正确更改,但指向资源文件的属性未正确更改。
但是:如果用户安装了相应的Windows-Language-Pack,应用程序运行正常。我的猜测是,Windows 将检查它将使用系统上安装的语言部署哪个语言资源文件:
我怎样才能避免这种情况?
However, if I deploy the app via Store->Create App Packages and then try to sideload the app on (different) Windows-10 machines the language change is not reflected correctly.
But: If the user has the corresponding Windows-Language-Pack installed, the app is working fine. My guess is, that Windows will
check which language-resource file it will deploy with the installed
languages on the system:
如果我将 "Generate App bundle" 设置为 "always" 或 "if needed",按照你说的这种方式,只有用户安装了相应的Windows-Language-Pack,应用才能正常运行。
这是因为如果我们将 "Generate App bundle" 设置为 "always" 或者"if needed",它将创建应用程序包。这意味着它将把您的应用程序分成不同的部分以优化下载。只会下载与设备相关的部分。例如,如果有不同分辨率的资源,它只会下载适合设备的资源。 语言也一样,它只会下载与设备语言相关的资源文件。因此,如果您尝试更改语言,它仍然会返回到相同的基本语言而失败,因为没有安装其他语言。因此,如果您没有安装相应的 Windows-Language-Pack,应用程序将不会显示指向资源文件的 属性 的相关语言。
更多信息,请尝试参考this blog。
How can I avoid this?
如果您想避免这种情况,解决方法是将 "Generate App bundle" 设置为 "never" 作为在创建应用程序包时遵循以下内容,我已经在我这边进行了测试,它工作正常:
我的 Universal-Windows-App 有问题:我让用户可以选择更改应用程序的语言。
为此,我为每种语言创建了一个 "Ressources.resw" 文件,我的 XAML 代码通过 x:UID=
部分引用资源。通过 primaryLanguageOverride 更改语言
这在我的环境中工作正常。但是,如果我通过 Store->Create App Packages
部署应用程序,然后尝试在(不同的)Windows-10 台机器上加载应用程序,则语言更改不会正确反映。例如,日期格式正在正确更改,但指向资源文件的属性未正确更改。
但是:如果用户安装了相应的Windows-Language-Pack,应用程序运行正常。我的猜测是,Windows 将检查它将使用系统上安装的语言部署哪个语言资源文件:
我怎样才能避免这种情况?
However, if I deploy the app via Store->Create App Packages and then try to sideload the app on (different) Windows-10 machines the language change is not reflected correctly.
But: If the user has the corresponding Windows-Language-Pack installed, the app is working fine. My guess is, that Windows will check which language-resource file it will deploy with the installed languages on the system:
如果我将 "Generate App bundle" 设置为 "always" 或 "if needed",按照你说的这种方式,只有用户安装了相应的Windows-Language-Pack,应用才能正常运行。
这是因为如果我们将 "Generate App bundle" 设置为 "always" 或者"if needed",它将创建应用程序包。这意味着它将把您的应用程序分成不同的部分以优化下载。只会下载与设备相关的部分。例如,如果有不同分辨率的资源,它只会下载适合设备的资源。 语言也一样,它只会下载与设备语言相关的资源文件。因此,如果您尝试更改语言,它仍然会返回到相同的基本语言而失败,因为没有安装其他语言。因此,如果您没有安装相应的 Windows-Language-Pack,应用程序将不会显示指向资源文件的 属性 的相关语言。
更多信息,请尝试参考this blog。
How can I avoid this?
如果您想避免这种情况,解决方法是将 "Generate App bundle" 设置为 "never" 作为在创建应用程序包时遵循以下内容,我已经在我这边进行了测试,它工作正常: