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,
viewModel.status.language != lang
let statusLanguage = viewModel.status.reblog?.language ?? viewModel.status.language,
statusLanguage != lang
{
Button {
Task {
await viewModel.translate(userLang: lang)
}
} label: {
if let statusLanguage = viewModel.status.language,
let languageName = Locale.current.localizedString(forLanguageCode: statusLanguage)
{
if let languageName = Locale.current.localizedString(forLanguageCode: statusLanguage) {
Label("status.action.translate-from-\(languageName)", systemImage: "captions.bubble")
} else {
Label("status.action.translate", systemImage: "captions.bubble")