android: Cannot localize app anymore in Xam.Android 11.2 - System.Resources.ResourceManager.GetString ignores the CultureInfo

Description

Since updating from Xamarin.Android 11.1 to 11.2, we are not able to display localized strings anymore: they always default to the base language .resx file. (we are using a localization approach similar to this project https://github.com/hot33331/ResxI18N ). So, basically, (see https://github.com/hot33331/ResxI18N/blob/master/ResxI18N/Helpers/TranslateExtension.cs ) no matter what CultureInfo you pass in var translation = ResMgr.Value.GetString(Text, ci);, it will always retrieve the default resx string.

More specifically I have found that:

VERSION					DEBUG			RELEASE

xamarin.android-11.2.0.21		Working			NOT Working
xamarin.android-11.2.0.0		NOT Working		NOT Working
xamarin.android-11.1.0.26		Working			Working

For some reason when deploying the app (both in the simulator and in real devices) in debug mode with 11.2 it does not work, while doing that with 11.2.0.21 it works, yet it still does not work in release mode, and that is critical!

Version Information

Visual Studio Community 2019 for Mac Version 8.9.1 (build 34)

Installation UUID: 3047ce14-1f52-4878-b6c4-5b4461104fb0
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

	Package version: 612000122

Mono Framework MDK
Runtime:
	Mono 6.12.0.122 (2020-02/c621c35ffa0) (64-bit)
	Package version: 612000122

Roslyn (Language Service)
3.9.0-6.21152.10+c10f884b30737542ddd84ca889a4aad9281ce210

NuGet
Version: 5.8.0.6860

.NET Core SDK
SDK: /usr/local/share/dotnet/sdk/6.0.100-preview.1.21103.13/Sdks
SDK Versions:
	6.0.100-preview.1.21103.13
	5.0.201
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	3.1.407
	3.1.406
	3.1.405
	3.1.404
	3.1.403
	3.1.402
	3.1.401
	3.1.302
	3.1.301
	3.1.300
	3.1.202
	3.1.200
	3.1.102
	3.1.101
	3.1.100
	3.0.101
	3.0.100
	2.1.701
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

.NET Core Runtime
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	6.0.0-preview.1.21102.12
	5.0.4
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	3.1.13
	3.1.12
	3.1.11
	3.1.10
	3.1.9
	3.1.8
	3.1.7
	3.1.6
	3.1.5
	3.1.4
	3.1.2
	3.1.1
	3.1.0
	3.0.1
	3.0.0
	2.1.23
	2.1.22
	2.1.21
	2.1.20
	2.1.19
	2.1.18
	2.1.17
	2.1.16
	2.1.15
	2.1.14
	2.1.13
	2.1.12

.NET Core 3.1 SDK
SDK: 3.1.407

Xamarin.Profiler
Version: 1.6.12.26
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Xamarin.Android
Version: 11.2.0.21 (Visual Studio Community)
Commit: xamarin-android/d16-9/93eab59
Android SDK: /Users/mpazzaglia/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		5.0 (API level 21)
		8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 31.0.0
SDK Build Tools Version: 30.0.2

Build Information: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@d6d86b2
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.34.1@daff8f4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-9@9d8924d

Microsoft OpenJDK for Mobile
Java SDK: /Users/mpazzaglia/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.9.0.22
Hash: a391de2
Branch: remotes/origin/d16-9
Build date: 2021-02-18 03:14:56 UTC

Android Device Manager
Version: 16.9.0.17
Hash: fc2b3db
Branch: remotes/origin/d16-9
Build date: 2021-02-18 03:15:18 UTC

Xamarin Designer
Version: 16.9.0.316
Hash: bd2705417
Branch: remotes/origin/d16-9
Build date: 2021-02-24 00:16:08 UTC

Apple Developer Tools
Xcode 12.4 (17801)
Build 12D4e

Xamarin.Mac
Version: 7.8.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:43-0500

Xamarin.iOS
Version: 14.14.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:44-0500

Build Information
Release ID: 809010034
Git revision: 33bce2b7f3d45d05865cd3282f1c2cdc3a112aa0
Build date: 2021-03-04 11:21:38-05
Build branch: release-8.9
Xamarin extensions: 33bce2b7f3d45d05865cd3282f1c2cdc3a112aa0

Operating System
Mac OS X 10.16.0
Darwin 20.3.0 Darwin Kernel Version 20.3.0
    Thu Jan 21 00:07:06 PST 2021
    root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

Enabled user installed extensions
AddinMaker 1.6.0

Workaround

Roll back to http://dl.xamarin.com/MonoforAndroid/Mac/xamarin.android-11.1.0.26.pkg

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 26 (11 by maintainers)

Most upvoted comments

@Kapusch can you file a new issue? If you can reproduce the problem command-line add a -bl and attach the msbuild.binlog file it creates, thanks!

The target above is a workaround for an old bug: https://github.com/xamarin/xamarin-android/issues/4805#issuecomment-642919727

You can remove it now, I think this was the issue, thanks!

@inimirpaz you seem have a custom task at the bottom of your csproj? is that on purpose?

<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>

This is completely overriding our own internal _ResolveSatellitePaths target. So I’m guessing that is why we could not replicate the issue.