Parcourir la source

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 il y a 1 mois
Parent
commit
6aa1f7b36c
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  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))")
             }