Skip to content

Commit 850d55b

Browse files
authored
Merge pull request #450 from nventive/dev/topi/fix-language-bug
fix: Adding workaround for language bug
2 parents 6d07b8e + 7be4cce commit 850d55b

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Prefix your items with `(Template)` if the change is about the template and not
88
## 3.10.X
99
- Added Dependency Injection validation in the development environment.
1010
- Cleaned up the persistence configuration files (removed unused parameters and updated documentation).
11+
- Adding a workaround for a bug with the language change on android.
1112

1213
## 3.9.X
1314
- Removed unnecessary `IsExternalInit.cs` files.

src/app/ApplicationTemplate.Shared.Views/Configuration/LocalizationConfiguration.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private static string GetSettingFilePath()
7575
var folderPath = string.Empty;
7676
//-:cnd:noEmit
7777
#endif
78-
//+:cnd:noEmit
78+
//+:cnd:noEmit
7979

8080
return Path.Combine(folderPath, "culture-override");
8181
}
@@ -170,7 +170,19 @@ public bool TryApply()
170170
{
171171
try
172172
{
173+
//-:cnd:noEmit
174+
#if ANDROID
175+
//+:cnd:noEmit
176+
// We need a special case for Android because the CurrentCulture does not return the correct value after changing the device language.
177+
var locale = Java.Util.Locale.Default; // Gets the real system language
178+
var culture = new CultureInfo(locale.ToString());
179+
//-:cnd:noEmit
180+
#else
181+
//+:cnd:noEmit
173182
var culture = CultureInfo.CurrentCulture;
183+
//-:cnd:noEmit
184+
#endif
185+
//+:cnd:noEmit
174186

175187
// Use the settings culture if it is set.
176188
var settingsCulture = GetCulture();

0 commit comments

Comments
 (0)