Selaa lähdekoodia

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 kuukausi sitten
vanhempi
sitoutus
6aa1f7b36c
1 muutettua tiedostoa jossa 3 lisäystä ja 2 poistoa
  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))")
             }