Fix translate button for boosts (#629)

This commit is contained in:
Thomas 2023-02-03 15:43:38 +01:00 committed by GitHub
parent dd28e7bccb
commit 4e69401b6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,16 +76,15 @@ struct StatusRowContextMenu: View {
} }
if let lang = preferences.serverPreferences?.postLanguage ?? Locale.current.language.languageCode?.identifier, if let lang = preferences.serverPreferences?.postLanguage ?? Locale.current.language.languageCode?.identifier,
viewModel.status.language != lang let statusLanguage = viewModel.status.reblog?.language ?? viewModel.status.language,
statusLanguage != lang
{ {
Button { Button {
Task { Task {
await viewModel.translate(userLang: lang) await viewModel.translate(userLang: lang)
} }
} label: { } label: {
if let statusLanguage = viewModel.status.language, if let languageName = Locale.current.localizedString(forLanguageCode: statusLanguage) {
let languageName = Locale.current.localizedString(forLanguageCode: statusLanguage)
{
Label("status.action.translate-from-\(languageName)", systemImage: "captions.bubble") Label("status.action.translate-from-\(languageName)", systemImage: "captions.bubble")
} else { } else {
Label("status.action.translate", systemImage: "captions.bubble") Label("status.action.translate", systemImage: "captions.bubble")