Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UWP: Resource file for languages is not deployed correctly

I have a problem with my Universal-Windows-App: I'm giving the user the option to change the language of the app.

For this propose I've created for each language a "Ressources.resw" file and my XAML-code referes via the x:UID= part to the resources. The language is changed via primaryLanguageOverride This is working fine in my environment. 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. For example the date-format is changing properly but the properties that are pointing to the resources file are not changing 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:

enter image description here

How can I avoid this?

like image 425
FikLi Avatar asked Aug 23 '16 18:08

FikLi


1 Answers

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:

I can reproduce this behavior if I have set the "Generate App bundle" as "always" or "if needed", in this way as you said only if the user has the corresponding Windows-Language-Pack installed, then the app will work fine.

The reason for that it is because that if we have set the "Generate App bundle" as "always" or "if needed", it will create the app bundle. It means that it will cut your application into different parts to optimize the download. Only the parts that are relevant for the devices will be downloaded. For example, if there are the assets in different resolution, it will only download the ones that are suitable for the device. Same thing for languages, it will only download the resources file relevant to the language of the device. So if you try to change language, it will fail still fall back on the same base language, because others are not installed. So if you do not have the corresponding Windows-Language-Pack installed, the app will do not show the related language for that property which are pointing to the resources file.

For more information, please try to refer to this blog.

How can I avoid this?

If you want to avoid this, the workaround is to set the "Generate App bundle" as "never" as following when creating the app package and I have tested in my side, it works fine: enter image description here

like image 159
Amy Peng - MSFT Avatar answered Oct 05 '22 23:10

Amy Peng - MSFT