Przeglądaj źródła

Localize speech language picker names using the selected app language.

Speech locale labels were formatted with Locale.current, so they stayed in English when the UI was set to French or another language.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 miesiąc temu
rodzic
commit
6aa1f7b36c
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3 2
      meetings_app/ViewController.swift

+ 3 - 2
meetings_app/ViewController.swift

@@ -3908,12 +3908,13 @@ private extension ViewController {
         candidates.insert(currentIdentifier)
         candidates.insert(englishUSIdentifier)
 
+        let displayLocale = AppLanguageManager.formattingLocale
         return candidates
             .map { identifier -> SpeechLocaleOption in
                 let locale = Locale(identifier: identifier)
                 let languageCode = locale.languageCode ?? Locale.components(fromIdentifier: identifier)[NSLocale.Key.languageCode.rawValue]
-                let languageName = Locale.current.localizedString(forIdentifier: identifier)
-                    ?? languageCode.flatMap { Locale.current.localizedString(forLanguageCode: $0) }
+                let languageName = displayLocale.localizedString(forIdentifier: identifier)
+                    ?? languageCode.flatMap { displayLocale.localizedString(forLanguageCode: $0) }
                     ?? identifier
                 return SpeechLocaleOption(identifier: identifier, displayName: "\(languageName) (\(identifier))")
             }