testing
testing

Reputation: 20289

Use localization in a PCL

I have localized my Xamarin.Forms project (PCL approach). Additionally, I added another PCL as reference to this project by referencing the output dll from the Debug folder. This PCL is also localized after the same approach like the Xamarin.Forms project by using RESX files and setting the culture with AppResources.Culture = ci;

The current issue is, that this works as expected on my local machine, but not on the build server (Jenkins calling MSBuild). The difference also is that I work in the Debug mode, the generated apk file (Android) is build in the Release mode. But regardless of the mode, locally the localization is working fine in both modes! On the build server the resulting apk file contains now a mixture of two languages:

Now I don't understand why this works locally, but not on the build server side. What I tried:

Is this a configuration issue on the build server in combination with MSBuild? If yes, what is different or missing? Or is this a code issue? Is this a problem using the same name AppResources for localization in both projects (XF and additional PCL)? Do you have any hints for me to find this issue?

Upvotes: 1

Views: 407

Answers (1)

testing
testing

Reputation: 20289

The issue was that the result of the PCL (a dll) was copied to the XF project. But the build artefacts of the PCL also contains language specific resources (called satellite assembly). The folder structure looks like the following:

MyLib/bin/Debug/MyLib.dll
MyLib/bin/Debug/en/MyLib.resources.dl

The folder en depends on your supported languages and can differ. If I copy all the required files with the same folder structure to the XF project, the translation works as expected. That was the reason, why it worked locally. It seems, that it isn't necessary to set the Culture in the resource files of the additional PCL.

Upvotes: 0

Related Questions