mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-24 06:48:10 +00:00
Don't show the source-language before translating (#1008)
* Clear up the translate-button The Translate button on the post and in the context menu now does not show the source language to avoid user confusion if the language set by the poster is not the actual language of the post. This language is now only used to decide whether to display the button in the main view. The Translate button in the context menu is independent. Signed-off-by: Paul Schuetz <pa.schuetz@web.de> * Show the translation-source-language The source-language of a translation is now shown. Signed-off-by: Paul Schuetz <pa.schuetz@web.de> * Remove unused strings The now unused translate-from-strings are removed. Signed-off-by: Paul Schuetz <pa.schuetz@web.de> --------- Signed-off-by: Paul Schuetz <pa.schuetz@web.de> Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
This commit is contained in:
parent
fc63830b27
commit
4af78478ba
21 changed files with 59 additions and 66 deletions
|
@ -2,37 +2,37 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>timeline-new-posts %lld</key>
|
||||
<dict>
|
||||
<key>NSStringLocalizedFormatKey</key>
|
||||
<string>%#@timelineNewPosts@</string>
|
||||
<key>timelineNewPosts</key>
|
||||
<dict>
|
||||
<key>NSStringFormatSpecTypeKey</key>
|
||||
<string>NSStringPluralRuleType</string>
|
||||
<key>NSStringFormatValueTypeKey</key>
|
||||
<string>lld</string>
|
||||
<key>one</key>
|
||||
<string>%lld new post</string>
|
||||
<key>other</key>
|
||||
<string>%lld new posts</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>notifications-others-count %lld</key>
|
||||
<dict>
|
||||
<key>NSStringLocalizedFormatKey</key>
|
||||
<string>%#@noficationsOthersCount@</string>
|
||||
<key>noficationsOthersCount</key>
|
||||
<dict>
|
||||
<key>NSStringFormatSpecTypeKey</key>
|
||||
<string>NSStringPluralRuleType</string>
|
||||
<key>NSStringFormatValueTypeKey</key>
|
||||
<string>lld</string>
|
||||
<key>one</key>
|
||||
<string> and %lld other </string>
|
||||
<key>other</key>
|
||||
<string> and %lld others </string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>timeline-new-posts %lld</key>
|
||||
<dict>
|
||||
<key>NSStringLocalizedFormatKey</key>
|
||||
<string>%#@timelineNewPosts@</string>
|
||||
<key>timelineNewPosts</key>
|
||||
<dict>
|
||||
<key>NSStringFormatSpecTypeKey</key>
|
||||
<string>NSStringPluralRuleType</string>
|
||||
<key>NSStringFormatValueTypeKey</key>
|
||||
<string>lld</string>
|
||||
<key>one</key>
|
||||
<string>%lld new post</string>
|
||||
<key>other</key>
|
||||
<string>%lld new posts</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>notifications-others-count %lld</key>
|
||||
<dict>
|
||||
<key>NSStringLocalizedFormatKey</key>
|
||||
<string>%#@noficationsOthersCount@</string>
|
||||
<key>noficationsOthersCount</key>
|
||||
<dict>
|
||||
<key>NSStringFormatSpecTypeKey</key>
|
||||
<string>NSStringPluralRuleType</string>
|
||||
<key>NSStringFormatValueTypeKey</key>
|
||||
<string>lld</string>
|
||||
<key>one</key>
|
||||
<string> and %lld other </string>
|
||||
<key>other</key>
|
||||
<string> and %lld others </string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -372,8 +372,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Перакласці";
|
||||
"status.action.translate-from-%@" = "Перакласці з %@";
|
||||
"status.action.translated-label-%@" = "Пераклад з дапамогай %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Закладка";
|
||||
"status.action.boost" = "Павышэнне";
|
||||
"status.action.boost-to-followers" = "Павысіць для падпісчыкаў";
|
||||
|
|
|
@ -366,8 +366,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Tradueix";
|
||||
"status.action.translate-from-%@" = "Tradueix del %@";
|
||||
"status.action.translated-label-%@" = "Traduït amb %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Afegeix als marcadors";
|
||||
"status.action.boost" = "Impulsa";
|
||||
"status.action.boost-to-followers" = "Boost to Followers";
|
||||
|
|
|
@ -363,8 +363,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Übersetzen";
|
||||
"status.action.translate-from-%@" = "Aus %@ übersetzen";
|
||||
"status.action.translated-label-%@" = "Übersetzt mit %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Aus %@ mit %@ übersetzt";
|
||||
"status.action.bookmark" = "Lesezeichen setzen";
|
||||
"status.action.boost" = "Boosten";
|
||||
"status.action.boost-to-followers" = "An Follower boosten";
|
||||
|
|
|
@ -369,8 +369,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Translate";
|
||||
"status.action.translate-from-%@" = "Translate from %@";
|
||||
"status.action.translated-label-%@" = "Translated using %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Bookmark";
|
||||
"status.action.boost" = "Boost";
|
||||
"status.action.boost-to-followers" = "Boost to Followers";
|
||||
|
|
|
@ -368,8 +368,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Translate";
|
||||
"status.action.translate-from-%@" = "Translate from %@";
|
||||
"status.action.translated-label-%@" = "Translated using %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Bookmark";
|
||||
"status.action.boost" = "Boost";
|
||||
"status.action.boost-to-followers" = "Boost to Followers";
|
||||
|
|
|
@ -368,8 +368,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Traducir";
|
||||
"status.action.translate-from-%@" = "Traducir desde %@";
|
||||
"status.action.translated-label-%@" = "Traducido usando %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Añadir a marcadores";
|
||||
"status.action.boost" = "Retootear";
|
||||
"status.action.boost-to-followers" = "Retootear a tus seguidores";
|
||||
|
|
|
@ -361,8 +361,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Itzuli";
|
||||
"status.action.translate-from-%@" = "Itzuli %@(e)tik";
|
||||
"status.action.translated-label-%@" = "%@ erabiliz itzulia";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Jarri laster-marka";
|
||||
"status.action.boost" = "Bultzatu";
|
||||
"status.action.boost-to-followers" = "Bultzatu jarraitzaileek ikus dezaten";
|
||||
|
|
|
@ -363,8 +363,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Traduire";
|
||||
"status.action.translate-from-%@" = "Traduire de %@";
|
||||
"status.action.translated-label-%@" = "Traduit avec %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Marquer";
|
||||
"status.action.boost" = "Promouvoir";
|
||||
"status.action.boost-to-followers" = "Boost to Followers";
|
||||
|
|
|
@ -368,8 +368,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Traduci";
|
||||
"status.action.translate-from-%@" = "Traduci da %@";
|
||||
"status.action.translated-label-%@" = "Tradotto usando %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Salva nei segnalibri";
|
||||
"status.action.boost" = "Condividi";
|
||||
"status.action.boost-to-followers" = "Condividi con i follower";
|
||||
|
|
|
@ -367,8 +367,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "翻訳";
|
||||
"status.action.translate-from-%@" = "%@ から翻訳";
|
||||
"status.action.translated-label-%@" = "%@ を使用して翻訳";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "ブックマーク";
|
||||
"status.action.boost" = "ブースト";
|
||||
"status.action.boost-to-followers" = "フォロワーにブースト";
|
||||
|
|
|
@ -369,8 +369,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "번역";
|
||||
"status.action.translate-from-%@" = "%@에서 번역";
|
||||
"status.action.translated-label-%@" = "번역 제공: %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "보관함에 추가";
|
||||
"status.action.boost" = "부스트";
|
||||
"status.action.boost-to-followers" = "팔로워에게만 부스트";
|
||||
|
|
|
@ -367,8 +367,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Oversett";
|
||||
"status.action.translate-from-%@" = "Oversett fra %@";
|
||||
"status.action.translated-label-%@" = "Oversatt ved hjelp av %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Bokmerk";
|
||||
"status.action.boost" = "Forsterk";
|
||||
"status.action.boost-to-followers" = "Boost to Followers";
|
||||
|
|
|
@ -362,8 +362,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Vertaal";
|
||||
"status.action.translate-from-%@" = "Vertaal uit het %@";
|
||||
"status.action.translated-label-%@" = "Vertaald met behulp van %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Voeg bladwijzer toe";
|
||||
"status.action.boost" = "Boost";
|
||||
"status.action.boost-to-followers" = "Boost aan volgers";
|
||||
|
|
|
@ -363,8 +363,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Przetłumacz";
|
||||
"status.action.translate-from-%@" = "Przetłumacz tekst %@";
|
||||
"status.action.translated-label-%@" = "Przetłumaczono za pomocą %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Dodaj zakładkę";
|
||||
"status.action.boost" = "Podbij";
|
||||
"status.action.boost-to-followers" = "Podbij do obserwujących";
|
||||
|
|
|
@ -367,8 +367,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Traduzir";
|
||||
"status.action.translate-from-%@" = "Traduzir do %@";
|
||||
"status.action.translated-label-%@" = "Traduzir usando %@";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Salvar";
|
||||
"status.action.boost" = "Boost";
|
||||
"status.action.boost-to-followers" = "Boost to Followers";
|
||||
|
|
|
@ -363,8 +363,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "Tercüme et";
|
||||
"status.action.translate-from-%@" = "Tercüme et %@";
|
||||
"status.action.translated-label-%@" = "%@ tarafından tercüme edildi";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "Yer İmi Ekle";
|
||||
"status.action.boost" = "Yükselt";
|
||||
"status.action.boost-to-followers" = "Boost to Followers";
|
||||
|
|
|
@ -366,8 +366,8 @@
|
|||
|
||||
// MARK: Package: Status
|
||||
"status.action.translate" = "翻译";
|
||||
"status.action.translate-from-%@" = "翻译 %@";
|
||||
"status.action.translated-label-%@" = "由 %@ 翻译";
|
||||
"status.action.translated-label-from-%@-%@" = "Translated from %@ using %@";
|
||||
"status.action.bookmark" = "书签";
|
||||
"status.action.boost" = "转发";
|
||||
"status.action.boost-to-followers" = "转发给粉丝";
|
||||
|
|
|
@ -312,10 +312,6 @@ public class StatusRowViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func translate(userLang: String) async {
|
||||
await translate(userLang: userLang, sourceLang: getStatusLang())
|
||||
}
|
||||
|
||||
private func translate(userLang: String, sourceLang _: String?) async {
|
||||
do {
|
||||
withAnimation {
|
||||
isLoadingTranslation = true
|
||||
|
|
|
@ -145,13 +145,7 @@ struct StatusRowContextMenu: View {
|
|||
await viewModel.translate(userLang: lang)
|
||||
}
|
||||
} label: {
|
||||
if let statusLang = viewModel.getStatusLang(),
|
||||
let languageName = Locale.current.localizedString(forLanguageCode: statusLang)
|
||||
{
|
||||
Label("status.action.translate-from-\(languageName)", systemImage: "captions.bubble")
|
||||
} else {
|
||||
Label("status.action.translate", systemImage: "captions.bubble")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,15 @@ struct StatusRowTranslateView: View {
|
|||
}
|
||||
}
|
||||
|
||||
private func getLocalizedString(langCode: String, provider: String) -> String {
|
||||
if let localizedLanguage = Locale.current.localizedString(forLanguageCode: langCode) {
|
||||
let format = NSLocalizedString("status.action.translated-label-from-%@-%@", comment: "")
|
||||
return String.localizedStringWithFormat(format, localizedLanguage, provider)
|
||||
} else {
|
||||
return "status.action.translated-label-\(provider)"
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if !isInCaptureMode,
|
||||
let userLang = preferences.serverPreferences?.postLanguage,
|
||||
|
@ -38,13 +47,7 @@ struct StatusRowTranslateView: View {
|
|||
if viewModel.isLoadingTranslation {
|
||||
ProgressView()
|
||||
} else {
|
||||
if let statusLanguage = viewModel.getStatusLang(),
|
||||
let languageName = Locale.current.localizedString(forLanguageCode: statusLanguage)
|
||||
{
|
||||
Text("status.action.translate-from-\(languageName)")
|
||||
} else {
|
||||
Text("status.action.translate")
|
||||
}
|
||||
}
|
||||
}
|
||||
.buttonStyle(.borderless)
|
||||
|
@ -55,7 +58,7 @@ struct StatusRowTranslateView: View {
|
|||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(translation.content.asSafeMarkdownAttributedString)
|
||||
.font(.scaledBody)
|
||||
Text("status.action.translated-label-\(translation.provider)")
|
||||
Text(getLocalizedString(langCode: translation.detectedSourceLanguage, provider: translation.provider))
|
||||
.font(.footnote)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue