xamarin/Xamarin.Forms

[Android] Localization does not work properly with "Bundle assemblies into native code" option enabled

Open

#1,595 opened on Jan 17, 2018

View on GitHub
 (17 comments) (3 reactions) (0 assignees)C# (1,926 forks)batch import
a/l10ne/5 :clock5:help wantedi/lowm/high impact :black_large_square:p/Androidt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

Localization does not work properly with "Bundle assemblies into native code" option enabled in release mode. Once the locale is changed, the app picks the default locale strings(English), although the language/locale was changed to, say, spanish/french.

To fully change the strings, we have to force kill the app (Remove from recent apps section), and then restart the app, only then the strings are picked correctly according to the set locale. The locale changes only once per session of the app. If we change the locale again from spanish to french, it starts picking default strings(English) again and we have to force kill the app and restart again.

However this problem doesn't occur when running in debug mode, or in release mode with "Bundle assemblies into native code" switched off. The resource strings are in Xamarin.Forms project and we are changing the locale as given in this link. Somewhat very similar to this bug . Also, the said workaround in the bug comments don't work either.

Steps to Reproduce

  1. Create Xamarin.Forms app
  2. Add localization support as shown here
  3. Enable "Bundle assemblies into native code" in Android build options
  4. Start the app and change the language

Expected Behavior

App should change the locale and display the strings of the changed locale.

Actual Behavior

App shows the default(English) locale strings, doesn't change the strings until next restart of the app.

Basic Information

  • Version with issue:
  • Last known good version:
  • IDE: VS 2017 Enterprise 15.5.1
  • Platform Target Frameworks: iOS, Android
  • iOS:
  • Android: 8.1.0.24 (HEAD/9cfa7836b)
  • UWP:
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Contributor guide