xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

Xamarin app does not localize due to lower-case satellite assembly folder names #15744

Open mathewssj opened 1 year ago

mathewssj commented 1 year ago

Description

Our Xamarin app uses localization with satellite assemblies which are packaged in to the apk (Android) and ipa (iOS) packages under sub-folders matching the appropriate culture (e.g. fr-FR for French). This appears to now be broken as the packaging creates lower-case folders (e.g. fr-fr) and then when the package is installed on a device the localization is not working. I have attached a sample solution with Android and iOS projects in and the resulting Android apk. Inside the apk the French folder is "fr-fr" instead of "fr-FR". On the main page of the app when the device is set to French the text should read "Cette valeur doit être localisée" but it reads "This value should be localized".

Is this something that has changed in the packaging? We use msbuild with the switch /t:PackageForAndroid to build the APK.

Please note: This is not a duplication of #8728 which was an iOS only bug that was previously fixed in 2020.

Steps to Reproduce

  1. Open the sample solution attached
  2. Use the Archive option in Visual Studio to create the Android package
  3. Install the package on an Android device and run to view the main page. Switch from English to French and re-run the app and the text does not change.

Expected Behavior

When in French the text should read "Cette valeur doit être localisée" as that is the value in the satellite assembly. The sub-folder in the Android package should be "fr-FR"

Actual Behavior

The text still reads "This value should be localized" (from the default culture). The sub-folder in the Android package is "fr-fr"

Basic Information

Environment

Show/Hide Visual Studio info ``` Microsoft Visual Studio Community 2022 Version 17.5.5 VisualStudio.17.Release/17.5.5+33627.172 Microsoft .NET Framework Version 4.8.09032 Installed Version: Community Visual C++ 2022 00482-90000-00000-AA462 Microsoft Visual C++ 2022 ASP.NET and Web Tools 17.5.320.55692 ASP.NET and Web Tools Azure App Service Tools v3.0.0 17.5.320.55692 Azure App Service Tools v3.0.0 Azure Functions and Web Jobs Tools 17.5.320.55692 Azure Functions and Web Jobs Tools C# Tools 4.5.2-3.23171.7+d17f741546fad2786cbd6394d08619544e53a36d C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools. Entrian Source Search 2022 1.0 Instant full-text search for your source code. Extensibility Message Bus 1.4.3 (main@2a4517a) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration. Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines Mono Debugging for Visual Studio 17.5.9 (11975e6) Support for debugging Mono processes with Visual Studio. NuGet Package Manager 6.5.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/ Razor (ASP.NET Core) 17.5.2.2316603+9f1b6856460af 1e592d387ebef416eadddac453f Provides languages services for ASP.NET Core Razor. SQL Server Data Tools 17.2.40120.0 Microsoft SQL Server Data Tools TypeScript Tools 17.0.20105.2003 TypeScript Tools for Microsoft Visual Studio Visual Basic Tools 4.5.2-3.23171.7+d17f741546fad2786cbd6394d08619544e53a36d Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Visual F# Tools 17.5.0-beta.23053.5+794b7c259d9646a7eb685dad865aa27da7940a21 Microsoft Visual F# Tools Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio. VisualStudio.DeviceLog 1.0 Information about my package VisualStudio.Mac 1.0 Mac Extension for Visual Studio VSPackage Extension 1.0 VSPackage Visual Studio Extension Detailed Info Xamarin 17.5.0.173 (d17-5@33e727c) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin Designer 17.5.3.46 (remotes/origin/d17-5@e4dd80b2bb) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Templates 17.5.41 (ba80d05) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin.Android SDK 13.2.0.0 (d17-5/797e2e1) Xamarin.Android Reference Assemblies and MSBuild support. Mono: 6dd9def Java.Interop: xamarin/java.interop/main@149d70fe SQLite: xamarin/sqlite/3.40.0@fdc1e34 Xamarin.Android Tools: xamarin/xamarin-android-tools/main@9f02d77 Xamarin.iOS and Xamarin.Mac SDK 16.2.0.5 (7738c90c9) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support. ```

Build Logs

Screenshots

Reproduction Link

Workaround

Attachments

com.companyname.xamarinlocalizationsample.apk.zip

XamarinLocalizationSample.zip

jfversluis commented 1 year ago

@jonpryor this seems like its more Android specific. Are you aware of any changes here?

mathewssj commented 1 year ago

Is there any progress on this issue?