xamarin/Xamarin.Forms

[Android] CultureInfo does not update when the user changes language choice while the app is running

オープン

#4,282 opened on 2018/11/01

 (5 件のコメント) (1 件のリアクション) (0 人の担当者)C# (1,926 件のフォーク)batch import
a/l10ne/4 :clock4:help wantedp/Androidt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

Steps to Reproduce

  1. Create a new app
  2. Add the following in the constructor of App.xaml.cs
CultureInfo.CurrentCulture.ClearCachedData();
CultureInfo.CurrentUICulture.ClearCachedData();
var x = CultureInfo.CurrentCulture;
var y = CultureInfo.CurrentUICulture;
  1. Observe that initially, the culture is set to en-US (assuming you have English US language as your top choice)
  2. While the app is running, go to Android settings and change your main language to something else and hit apply.
  3. Go back to the app. Notice that the App constructor is run again, but the culture info is not updated despite us clearing cached data.
  4. Exit the app and run it again. Observe that the culture info is updated this time.

Ref: #3949 & https://github.com/xamarin/Xamarin.Forms/pull/423

EDIT: RegionInfo.CurrentRegion is not updated either.

コントリビューターガイド