testing
testing

Reputation: 20279

Xamarin.Forms: Localization of the UWP app

If I run my app on an UWP device I get the following warning in the Output window:

MakePRI : warning 0xdef00522: Resources found for language(s) 'en,de' but no resources found for default language(s): 'de-DE,en-US'. Change the default language or qualify resources with the default language. http://go.microsoft.com/fwlink/?LinkId=231899

Don't know if this is related, but I also get

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2459,5): warning : APPX4001: Build property AppxBundlePlatforms is not explicitly set and is calculated based on currently building architecture. Use 'Create App Package' wizard or edit project file to set it.

This page states, that I have language specific resources, which I haven't qualified with the language tag. How can I find out, which resources these are?

I have images in the Assets folder, but they are language independent ones. Furthermore, I've set the default language in the Package.appxmanifest to de-DE. If I search for the language abbrevation from the warning, I can only find a priconfig.xml and AppxManifest.xml, both in the Debug output folder.

What should I do to remove this warning?

Edit:

The warning seems to disappear if I add a AppResources.en-US.resx file (currently I have en-US set as default language in Package.appxmanifest). Additionally, I have a file for AppResources.de.resx and AppResources.resx (should be en). But why does the sample project doesn't need such a file, despite there should be the same settings? What I'm missing?

Upvotes: 4

Views: 1970

Answers (2)

Emil
Emil

Reputation: 6893

Just to extend answer from Nico Zhu - MSFT if you are using .Net Standard there is no assemblyInfo.cs file because everything is stored in the csproj file. So just go to properties of the shared project and change the Project neutral language to whatever your resx default file is. or you can right click on the project and edit the project and the line below.

For me problem was,after converting from PCL to Net Standard, suddently UWP application wasnt picking the default resource file which was en-US. I recognized because i was having this setting in assmeblyInfo.cs and since It was removed, it didnt work. But somehow it works fine for Android project.

  <PropertyGroup>
     <NeutralLanguage>en-US</NeutralLanguage>
  </PropertyGroup>

enter image description here

Upvotes: 4

Nico Zhu
Nico Zhu

Reputation: 32775

The warning seems to disappear if I add a AppResources.en-US.resx file (currently I have en-US set as default language in Package.appxmanifest). Additionally, I have a file for AppResources.de.resx and AppResources.resx (should be en). But why does the sample project doesn't need such a file, despite there should be the same settings? What I'm missing?

As you said, the AppResources.resx is en. And you could expand the Properties node in the Portable Class Library (PCL) project and double-click on the AssemblyInfo.cs file. Add the following line to the file to set the neutral resources assembly language to English:

[assembly: NeutralResourcesLanguage("en")]

This informs the resource manager of the app's default culture, therefore ensuring that the strings defined in the language neutral RESX file (AppResources.resx) will be displayed when the app is running in one the English locales.

You have set en-US as default language in Package.appxmanifest, However, there is no such file corresponding to it. So it will throw warning.

The default language of the sample project is en-US, and there is no such file corresponding to it. It also throw the same warning in my side. if you modify the default language to en, the warning disappear. Because it has set AppResources.resx as en in AssemblyInfo.cs file.

Foe more you could refer to AssemblyInfo, Supported languages.

Upvotes: 6

Related Questions