Janusz-kun
Janusz-kun

Reputation: 89

Use all culture versions of resources files in UWP app

Accoding to Andy Wigley on this video https://www.microsoftvirtualacademy.com/en-US/training-courses/a-developer-s-guide-to-windows-10-12618 (look in additional resources -> Localization), UPW apps download only the culture resources they need.

I'm writing an app that uses resource files not only to translate UI but also generate files for the user. User may want to generate files in different culture than the one the OS uses. How I can assure that e.g. if my system is in en-US I will be able to get resources in french?

I may use own XML files that all will be included in the app. But some of the resource for sure will be needed also in UI, so I don't want to duplicate the resources and have to translate them twice.

Upvotes: 1

Views: 1002

Answers (2)

Jeffrey Tippet
Jeffrey Tippet

Reputation: 3006

Rob's answer would work great for a new app, but it didn't work for me, as I had already shipped a previous version of the app as a bundled package. If you then try to switch to a non-bundled package, the store submission portal gives the error:

A previous submission for this app was released with a Windows 10 appxbundle. Subsequent submissions must continue to contain a Windows 10 appxbundle.

After reverse-engineering far too much of the build system, I found enough clues to discover this well-hidden documentation: https://msdn.microsoft.com/en-us/library/dn482043.aspx

Following the steps there, you'll still create a bundled package, but the toolchain won't use Language as a qualifier on which to separate out different bundles. In other words, the neutral package will have all the languages in it, while still bundling satellite packages for Scale (or whatever you like).

In case the MSDN page vanishes, the punchline is that you can override <AppxBundleAutoResourcePackageQualifiers> in your msbuild file to remove the Langauge qualifier:

<AppxBundleAutoResourcePackageQualifiers>Scale</AppxBundleAutoResourcePackageQualifiers>

Upvotes: 3

Rob Caplan - MSFT
Rob Caplan - MSFT

Reputation: 21899

If you do not want to separate out resources into separately downloadable bundles then you don't need to. When you build the app package you can choose to never create bundles so all resources are included in the main package.

See step six in Create an app package at https://msdn.microsoft.com/en-us/library/hh454036.aspx , but choose "never" instead of "always".

Upvotes: 2

Related Questions