Added the "navigationTitle" property to the ContentViewModel view model in the Sample app target to update the navigation title to show the selected locale.

This commit is contained in:
2026-07-07 00:59:40 +02:00
parent d27e5fb38f
commit 3dc5b2b7fc
4 changed files with 43 additions and 3 deletions
@@ -97,6 +97,14 @@ extension ContentView {
self.reporter = reporter
self.transcriber = transcriber
}
// MARK: Computed
/// The navigation title of ``ContentView``: the localized "Transcribe to " filled with the name of the selected ``locale``, so
/// the title updates on every locale change.
var navigationTitle: LocalizedStringResource {
.viewRecordingNavigationTitle(name(for: locale))
}
// MARK: Methods
+1 -1
View File
@@ -62,7 +62,7 @@ struct ContentView: View {
maxWidth: .infinity,
maxHeight: .infinity
)
.navigationTitle(.viewRecordingNavigationTitle)
.navigationTitle(model.navigationTitle)
#if !os(macOS)
.navigationBarTitleDisplayMode(.inline)
#endif