After latest update of Xamarin Forms and Visual Studio for Mac AppResources for different languages are not loaded: only default language is loaded (in iOS and Android app).
Translations should be loaded from correspnding AppResources files
Default language is always loaded
Before last update of Visual Studio for Mac everything work as expected and this part of the code has not been touched between VS updates!
Currently installed Visual Studio for Mac (not working, stopped working after update):
=== Visual Studio Community 2019 for Mac ===
Version 8.6 (build 4520)
Installation UUID: 69833a91-0eac-4ae5-b6a6-d5db1c20fbb4
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
Package version: 610000104
=== Mono Framework MDK ===
Runtime:
Mono 6.10.0.104 (2019-12/5d03a6fe116) (64-bit)
Package version: 610000104
=== Roslyn (Language Service) ===
3.6.0-3.20210.9+4eafdcb1bcbd8d3573f2ba6065e56d9b9ce4f8a3
=== NuGet ===
Version: 5.6.0.6591
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/3.1.300/Sdks
SDK Versions:
3.1.300
3.1.202
3.1.200
3.1.102
3.1.101
3.1.100
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.4
3.1.2
3.1.1
3.1.0
2.1.18
2.1.17
2.1.16
2.1.15
2.1.14
=== Xamarin.Profiler ===
Version: 1.6.15.68
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Xamarin.Android ===
Version: 10.3.1.0 (Visual Studio Community)
Commit: xamarin-android/d16-6/3fe860a
Android SDK: /Users/todor/Library/Android/sdk
Supported Android versions:
None installed
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.1
SDK Build Tools Version: 30.0.0 rc4
Build Information:
Mono: 165f4b0
Java.Interop: xamarin/java.interop/d16-6@2cab35c
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.31.1@49232bc
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-6@bfb66f3
=== Microsoft Mobile OpenJDK ===
Java SDK: /Users/todor/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.6.0.50
Hash: 5901879
Branch: remotes/origin/d16-6
Build date: 2020-04-30 04:01:22 UTC
=== Android Device Manager ===
Version: 16.6.0.95
Hash: 45d17b5
Branch: remotes/origin/d16-6
Build date: 2020-04-30 04:01:42 UTC
=== Apple Developer Tools ===
Xcode 11.5 (16139)
Build 11E608c
=== Xamarin.Mac ===
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
=== Xamarin.iOS ===
Version: 13.18.1.31 (Visual Studio Community)
Hash: b3eedfed9
Branch: d16-6
Build date: 2020-04-09 10:22:36-0400
=== Xamarin Designer ===
Version: 16.6.0.329
Hash: d4f8bcd13
Branch: remotes/origin/d16-6
Build date: 2020-04-24 02:16:02 UTC
=== Build Information ===
Release ID: 806004520
Git revision: 9c92c7baceef7771f8dcf5c86e1e1a66fdc26182
Build date: 2020-05-18 10:05:00-04
Build branch: release-8.6
Xamarin extensions: 9c92c7baceef7771f8dcf5c86e1e1a66fdc26182
=== Operating System ===
Mac OS X 10.15.4
Darwin 19.4.0 Darwin Kernel Version 19.4.0
Wed Mar 4 22:28:40 PST 2020
root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
Hello, I have an update: for Android I unziped an old build apk and an apk made with the last Mac VS. The "working apk" assemblies directory contained subdirs for each language:
en,fr,es,etc. each containing AppName.resources.dll
The new build does not contain any of these in the assemblies dir...
Same issue here but only on Android not on iOS.
Same problem here, only tested on android
Same issue in combination with Visual Studio 2019 latest update. Translations work fine in combination with iOS.
Same issue tested, with Android only, using Visual Studio 2019 for Windows version 16.6.0
Any news/comments on this from the team? By my standards this is a huge bug and is blocking the publication of our app containing important updates and fixes...
It was bad to face this issue in the morning of our sprint demo, luckily Azure pipeline seems to use an older version because translations work in our demo version. When building our app locally we face exactly the same problem with VS 16.6.0, when I pick my older laptop without the latest VS update, the translations work properly in the built Android app.
Facing the same issue... really wasted a day trying to figure out the issue. For me IOS part works fine. All translations are loaded. Android always load the default language. @samhouts Can you prortize this.
I'm having the same problem as well. Translations don't work on Android; they used to a few weeks ago (not sure which update broke it).
I confirm having the same issue happening on VS Windows 16.6 and VSMac8.6
This is a huge deal, since we have our app translated into several languages.
Perhaps this is related with Xamarin.Android update?
In iOS everything is workin correctly.
Can anyone confirm that this is definitely an issue on iOS as well, or is it just Android?
With apologies for the quick change after samhout's last question, I'll go ahead and tentatively close this item as a duplicate of: https://github.com/xamarin/xamarin-android/issues/4664
A temporary workaround is available in: https://github.com/xamarin/xamarin-android/issues/4664#issuecomment-632986668
(Based on the replies to this issue, I am confident that the mention of "in iOS and Android app" in the original comment referred to the fact that the solution was targeting both iOS and Android but that the localization problem only affects the Android app.)
On second thought, to provide discoverability of the issue via the Xamarin.Forms repo, I'll keep this item open and close it once a new version of Xamarin.Android is published that includes the fix.
To help surface the workaround in the mean time, I'll add it here too.
Use a text editor to open the _.csproj_ file for the affected Android app project (as opposed to the .NET Standard library), and replace the end of the file with the following lines:
<Target Name="_ResolveSatellitePaths"
DependsOnTargets="_ResolveAssemblies">
<ResolveAssemblyReference
AllowedAssemblyExtensions="$(AllowedReferenceAssemblyFileExtensions)"
AssemblyFiles="@(ResolvedUserAssemblies)"
AutoUnify="$(AutoUnifyAssemblyReferences)"
FindDependencies="True"
FindRelatedFiles="False"
FindSatellites="True"
SearchPaths="$(AssemblySearchPaths)"
TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
TargetFrameworkMonikerDisplayName="$(TargetFrameworkMonikerDisplayName)"
TargetFrameworkDirectories="$(TargetFrameworkDirectory)">
<Output TaskParameter="SatelliteFiles" ItemName="_AndroidResolvedSatellitePaths"/>
</ResolveAssemblyReference>
</Target>
</Project>
Explanation: This reverts the _ResolveSatellitePaths
MSBuild target to the previous implementation as used in Xamarin.Android 10.2.
Hello, I confirm the problem concerned only the Android builds. The workaround suggested by @brendanzagaeski works for me. Thanks a lot.
@brendanzagaeski , works for me too. Thanks! I hope that when the proper fix is released the workaround won't interfere with it.
Workaround seems to work for me as well.
No funcion贸 para mi, hay alguna novedad al respecto?
Release status update
A new Release version of Xamarin.Android has now been published on Windows that includes the fix for this item.
The fix is not yet available on macOS. I will update this item again when a Release version with the fix is available on macOS. If there are no unexpected complications, it will be available later this week.
Fix included in Xamarin.Android SDK version 10.3.1.4.
Fix included on Windows in Visual Studio 2019 version 16.6.1. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/. Once this update is installed, the workaround is no longer needed and can be removed from any affected projects.
Fix not yet available on macOS.
Fix not yet available in the Preview version. I will update this item again when a Preview version is available that includes the fix.
Muchas gracias por su pronta respuesta brendanzagaeski , tengo la ultima versi贸n 16.7.0, pero si es preview. Tengo alguna alternativa?
@Edinsondaviditm, if the workaround is not working in your project, then there is a chance something different is happening for your project. I just double-checked to make sure that the workaround was effective for me in Visual Studio 2019 version 16.7 Preview. It was successful for the test project I was using.
So if the workaround is not successful for your project, then I can suggest 2 possible ways forward:
Install the Release version Visual Studio 2019 version 16.6.2 side-by-side with the Preview version, and use the Release version for Xamarin.Android development until a fix is available in the next Visual Studio 2019 version 16.7 Preview version (some weeks from now).
Or create a new issue on the xamarin-android repository: https://github.com/xamarin/xamarin-android/issues/new/choose, and zip and attach the diagnostic MSBuild output from your project or a trimmed down sample project that demonstrates the problem so the team can take a look to see what is unique about your project. If the attachment contains private information, you can create a new Visual Studio Developer Community feedback item via Help > Send Feedback > Report a Problem in Visual Studio and attach the build output or sample project there instead. Thanks in advance!
Release status update
A new Release version of Xamarin.Android has now been published on macOS that includes the fix for this item to match yesterday's new version on Windows. Thanks again for submitting this issue that has helped improve the product!
Fix included in Xamarin.Android SDK version 10.3.1.4.
Fix included on macOS in Visual Studio 2019 for Mac version 8.6.2. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.
(Fix also included on Windows in Visual Studio 2019 version 16.6.1. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/.)
Fix not yet available in the Visual Studio 2019 Preview versions. I will add a few final comments on this item when Visual Studio 2019 Preview versions are available that include the fix.
Thanks, translations work again after the VS update.
Most helpful comment
On second thought, to provide discoverability of the issue via the Xamarin.Forms repo, I'll keep this item open and close it once a new version of Xamarin.Android is published that includes the fix.
To help surface the workaround in the mean time, I'll add it here too.
Workaround
Use a text editor to open the _.csproj_ file for the affected Android app project (as opposed to the .NET Standard library), and replace the end of the file with the following lines:
Explanation: This reverts the
_ResolveSatellitePaths
MSBuild target to the previous implementation as used in Xamarin.Android 10.2.