none
Localization does not work properly when package Windows 8.1 (C# XAML) app by setting Generate app bundle to Always.

    Question

  • I have developed a Windows 8.1 app with C# and XAML which should support localization. For changing language of the app, I used following code snippet,

    Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = theValidBCP-47LanguageCode;
    WindowsApplicationModel.Resources.Core.ResourceContext.ResetGlobalQualifierValues();

    and

    var languageCode = Windows.Globalization.ApplicationLanguages.Languages.First();

    returns the expected language code that I set by "theValidBCP-47LanguageCode".

    When I build and create app packages by setting "Generate app bundle" to "Never", Visual Studio (Enterprise 2015) generates app packages for all "ARM", "x86" and "x64" CPU architectures. And if I side-load the app using generated "Add-AppDevPackage.ps1" PowerShell script, localization of the app works as expected. And no need to add the languages to the device that are going to be used by the app before installing the app.

    However, when I generate app packages by setting "Generate app bundle" to "Always" and side-loading the app using generated PowerShell script, localization does not work as expected. This approach works fine when I have added the languages to the device (Surface 3 Pro)  that are going to be used by app prior to install the app. It does not work adding preferred languages after installing the app either. Even re-starting the app does not resolve the problem.

    I added Resource.resw files for each language inside separate folders that are named by language code (en-us, es-es...) and included them in a folder called "Strings" which is inside a folder called "Resources" in my solution.

    Please help me out on this issue. Thank you.




    Wednesday, June 29, 2016 5:51 AM

All replies

  • this happens when the language isnt configured on the device. during the appx installation the language bundle isnt installed because the system thinks it wont ever be used.

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, June 29, 2016 6:16 AM
  • Hi Dave,

    Thanks for your quick reply. But localization works properly when I install the app using one of the three separate app packages for different CPU architectures ("Generate app bundle" to "Never" option). It does not work only when installing the app using generated app bundle (.appxbundle). Do you have any idea on this?
    Wednesday, June 29, 2016 6:32 AM
  • yes; when you set the app bundle generation to never there wont be language bundles; so during the appx install it will install everything

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, June 29, 2016 6:35 AM
  • Hi

    In my case setting "Generate app bundle" to "Never" (generate 3 packages) option leads to work localization properly while setting Generate app bundle" to "Always (generate single package) leads to having issues with localization.

    Wednesday, June 29, 2016 6:59 AM
  • thats what i said. never generates no bundles (so end up with 3 packages for the different architectures); having bundles will solves that but introduces the problem with the localisation.

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, June 29, 2016 7:55 AM
  • Even though generating 3 packages ("Generate app bundle" to "Never") solves the localization problem, I have another problem in installing the app.

    First I have installed the app with single package (via PowerShell) and then when I am going to install the app using 3 packages, I ended up with following issue

    Found package: C:\Users\Calceyn\Desktop\with-log-3\Imsmart.Win_1.1.70.0_x64_Optos-QA_Test\Imsmart.Win_1.1.70.0_x64_Optos
    -QA.appx

    Installing app...
    Found dependency package(s):
    C:\Users\Calceyn\Desktop\with-log-3\Imsmart.Win_1.1.70.0_x64_Optos-QA_Test\Dependencies\x86\Microsoft.VCLibs.x86.12.00.
    appx
    C:\Users\Calceyn\Desktop\with-log-3\Imsmart.Win_1.1.70.0_x64_Optos-QA_Test\Dependencies\x64\Microsoft.VCLibs.x64.12.00.
    appx
    Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF6, Package could not be registered.

    Merge Failure : error 0x80073B0F : Cannot register the DA7331AC.19183000E042C_1.1.70.0_x64__e19f19rhp9mve package
    because there was a merge failure with the following file: C:\Program
    Files\WindowsApps\DA7331AC.19183000E042C_1.1.62.0_neutral_split.language-de_e19f19rhp9mve\resources.pri

    NOTE: For additional information, look for [ActivityId] cbfe201d-cef8-0002-543a-fecbf8ced101 in the Event Log or use
    the command line Get-AppxLog -ActivityID cbfe201d-cef8-0002-543a-fecbf8ced101

    At C:\Users\Calceyn\Desktop\with-log-3\Imsmart.Win_1.1.70.0_x64_Optos-QA_Test\Add-AppDevPackage.ps1:388 char:13
    +             Add-AppxPackage -Path $DeveloperPackagePath.FullName -DependencyPath ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : WriteError: (C:\Users\Calcey...4_Optos-QA.appx:String) [Add-AppxPackage], IOException
        + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

    Error: Could not install the app.

    Note that app is successfully installed when app bundle is generated.

    I need to know whether will this happen when I upload the app to the Store and download it via "Store" app. Already uploaded app is of single bundle. I need to upload app with 3 packages to solve the localization issue.

    Thanks.

    Wednesday, June 29, 2016 8:28 AM
  • As a solution for the localization issue with single bundle (.appxbundle), I generated 3 packages for 3 cpu architectures and tried to upload the (.appx) files to the Windows Store. Then it gives following error.

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

    It seems I have no way of solving the issue rather than informing each and every end user to uninstall the app by losing all the app data and add all the languages in the device that the app is going to support before reinstalling the app which is not practical. 

    Please let me know if there is a solution better than this.

    Wednesday, July 6, 2016 5:45 AM