From 2ffcfe06f3650885c5192d1b55f65ae5948c3613 Mon Sep 17 00:00:00 2001
From: Martin Schmidt <lpkkjhd@gmail.com>
Date: Fri, 9 May 2025 15:09:24 +0000
Subject: [PATCH] fix: properly work with languages with multiple scripts
 (#18167)

Co-authored-by: Ewe Zu Lin <zlewe1997@gmail.com>
---
 mobile/lib/constants/locales.dart | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/mobile/lib/constants/locales.dart b/mobile/lib/constants/locales.dart
index 836d3cf06f..45c09293f9 100644
--- a/mobile/lib/constants/locales.dart
+++ b/mobile/lib/constants/locales.dart
@@ -6,8 +6,8 @@ const Map<String, Locale> locales = {
   // Additional locales
   'Arabic (ar)': Locale('ar'),
   'Catalan (ca)': Locale('ca'),
-  'Chinese Simplified (zh_CN)': Locale('zh', 'SIMPLIFIED'),
-  'Chinese Traditional (zh_TW)': Locale('zh', 'Hant'),
+  'Chinese Simplified (zh_CN)': Locale('zh', 'CN'),
+  'Chinese Traditional (zh_TW)': Locale('zh', 'TW'),
   'Czech (cs)': Locale('cs'),
   'Danish (da)': Locale('da'),
   'Dutch (nl)': Locale('nl'),
@@ -31,8 +31,10 @@ const Map<String, Locale> locales = {
   'Portuguese (pt)': Locale('pt'),
   'Romanian (ro)': Locale('ro'),
   'Russian (ru)': Locale('ru'),
-  'Serbian Cyrillic (sr_Cyrl)': Locale('sr', 'Cyrl'),
-  'Serbian Latin (sr_Latn)': Locale('sr', 'Latn'),
+  'Serbian Cyrillic (sr_Cyrl)':
+      Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Cyrl'),
+  'Serbian Latin (sr_Latn)':
+      Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Latn'),
   'Slovak (sk)': Locale('sk'),
   'Slovenian (sl)': Locale('sl'),
   'Spanish (es)': Locale('es'),