Add a setting to turn off auto detect language when posting close #1461

This commit is contained in:
Thomas Ricouard 2023-07-17 20:39:53 +02:00
parent 2850c168b0
commit 4168c64d20
22 changed files with 49 additions and 1 deletions

View file

@ -38,6 +38,15 @@ struct TranslationSettingsView: View {
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
} }
} }
Section {
Toggle(isOn: preferences.$autoDetectPostLanguage) {
Text("settings.translation.auto-detect-post-language")
}
} footer: {
Text("settings.translation.auto-detect-post-language-footer")
}
} }
.navigationTitle("settings.translation.navigation-title") .navigationTitle("settings.translation.navigation-title")
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)

View file

@ -173,6 +173,8 @@
"settings.general.translate" = "Translation Settings"; "settings.general.translate" = "Translation Settings";
"settings.translation.navigation-title" = "Translation"; "settings.translation.navigation-title" = "Translation";
"settings.translation.always-deepl" = "Always Translate using DeepL"; "settings.translation.always-deepl" = "Always Translate using DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API Key"; "settings.translation.user-api-key" = "DeepL API Key";
"settings.translation.api-key-type" = "Type of the Key"; "settings.translation.api-key-type" = "Type of the Key";
"settings.translation.needed-message" = "This feature requires a DeepL API key"; "settings.translation.needed-message" = "This feature requires a DeepL API key";

View file

@ -167,6 +167,8 @@
"settings.general.translate" = "Translation Settings"; "settings.general.translate" = "Translation Settings";
"settings.translation.navigation-title" = "Translation"; "settings.translation.navigation-title" = "Translation";
"settings.translation.always-deepl" = "Always Translate using DeepL"; "settings.translation.always-deepl" = "Always Translate using DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API Key"; "settings.translation.user-api-key" = "DeepL API Key";
"settings.translation.api-key-type" = "Type of the Key"; "settings.translation.api-key-type" = "Type of the Key";
"settings.translation.needed-message" = "This feature requires a DeepL API key"; "settings.translation.needed-message" = "This feature requires a DeepL API key";

View file

@ -144,6 +144,8 @@
"settings.general.translate" = "Übersetzungseinstellungen"; "settings.general.translate" = "Übersetzungseinstellungen";
"settings.translation.navigation-title" = "Übersetzung"; "settings.translation.navigation-title" = "Übersetzung";
"settings.translation.always-deepl" = "Immer mit DeepL übersetzen"; "settings.translation.always-deepl" = "Immer mit DeepL übersetzen";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL-API-Schlüssel"; "settings.translation.user-api-key" = "DeepL-API-Schlüssel";
"settings.translation.api-key-type" = "Typ des Schlüssels"; "settings.translation.api-key-type" = "Typ des Schlüssels";
"settings.translation.needed-message" = "Für diese Funktion ist ein DeepL-API-Schlüssel erforderlich."; "settings.translation.needed-message" = "Für diese Funktion ist ein DeepL-API-Schlüssel erforderlich.";

View file

@ -174,6 +174,8 @@
"settings.general.translate" = "Translation Settings"; "settings.general.translate" = "Translation Settings";
"settings.translation.navigation-title" = "Translation"; "settings.translation.navigation-title" = "Translation";
"settings.translation.always-deepl" = "Always Translate using DeepL"; "settings.translation.always-deepl" = "Always Translate using DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API Key"; "settings.translation.user-api-key" = "DeepL API Key";
"settings.translation.api-key-type" = "Type of the Key"; "settings.translation.api-key-type" = "Type of the Key";
"settings.translation.needed-message" = "This feature requires a DeepL API key"; "settings.translation.needed-message" = "This feature requires a DeepL API key";

View file

@ -173,6 +173,8 @@
"settings.general.translate" = "Translation Settings"; "settings.general.translate" = "Translation Settings";
"settings.translation.navigation-title" = "Translation"; "settings.translation.navigation-title" = "Translation";
"settings.translation.always-deepl" = "Always Translate using DeepL"; "settings.translation.always-deepl" = "Always Translate using DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API Key"; "settings.translation.user-api-key" = "DeepL API Key";
"settings.translation.api-key-type" = "Type of the Key"; "settings.translation.api-key-type" = "Type of the Key";
"settings.translation.needed-message" = "This feature requires a DeepL API key"; "settings.translation.needed-message" = "This feature requires a DeepL API key";

View file

@ -144,6 +144,8 @@
"settings.general.translate" = "Ajustes de traducción"; "settings.general.translate" = "Ajustes de traducción";
"settings.translation.navigation-title" = "Traducción"; "settings.translation.navigation-title" = "Traducción";
"settings.translation.always-deepl" = "Traducir siempre con DeepL"; "settings.translation.always-deepl" = "Traducir siempre con DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "Clave API de DeepL"; "settings.translation.user-api-key" = "Clave API de DeepL";
"settings.translation.api-key-type" = "Tipo de clave"; "settings.translation.api-key-type" = "Tipo de clave";
"settings.translation.needed-message" = "Esta funcionalidad requiere una clave API de DeepL"; "settings.translation.needed-message" = "Esta funcionalidad requiere una clave API de DeepL";

View file

@ -144,6 +144,8 @@
"settings.general.translate" = "Itzulpenaren ezarpenak"; "settings.general.translate" = "Itzulpenaren ezarpenak";
"settings.translation.navigation-title" = "Itzulpenaren ezarpenak"; "settings.translation.navigation-title" = "Itzulpenaren ezarpenak";
"settings.translation.always-deepl" = "Itzuli beti DeepL erabiliz"; "settings.translation.always-deepl" = "Itzuli beti DeepL erabiliz";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API gakoa"; "settings.translation.user-api-key" = "DeepL API gakoa";
"settings.translation.api-key-type" = "Gako mota"; "settings.translation.api-key-type" = "Gako mota";
"settings.translation.needed-message" = "Ezaugarri honek DeepL API gako bat behar du"; "settings.translation.needed-message" = "Ezaugarri honek DeepL API gako bat behar du";

View file

@ -168,6 +168,8 @@
"settings.general.translate" = "Translation Settings"; "settings.general.translate" = "Translation Settings";
"settings.translation.navigation-title" = "Translation"; "settings.translation.navigation-title" = "Translation";
"settings.translation.always-deepl" = "Always Translate using DeepL"; "settings.translation.always-deepl" = "Always Translate using DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API Key"; "settings.translation.user-api-key" = "DeepL API Key";
"settings.translation.api-key-type" = "Type of the Key"; "settings.translation.api-key-type" = "Type of the Key";
"settings.translation.needed-message" = "This feature requires a DeepL API key"; "settings.translation.needed-message" = "This feature requires a DeepL API key";

View file

@ -143,6 +143,8 @@
"settings.general.translate" = "Translation Settings"; "settings.general.translate" = "Translation Settings";
"settings.translation.navigation-title" = "Translation"; "settings.translation.navigation-title" = "Translation";
"settings.translation.always-deepl" = "Always Translate using DeepL"; "settings.translation.always-deepl" = "Always Translate using DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API Key"; "settings.translation.user-api-key" = "DeepL API Key";
"settings.translation.api-key-type" = "Type of the Key"; "settings.translation.api-key-type" = "Type of the Key";
"settings.translation.needed-message" = "This feature requires a DeepL API key"; "settings.translation.needed-message" = "This feature requires a DeepL API key";

View file

@ -173,6 +173,8 @@
"settings.general.translate" = "翻訳設定"; "settings.general.translate" = "翻訳設定";
"settings.translation.navigation-title" = "翻訳設定"; "settings.translation.navigation-title" = "翻訳設定";
"settings.translation.always-deepl" = "DeepLを使用して常に翻訳する"; "settings.translation.always-deepl" = "DeepLを使用して常に翻訳する";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL APIキー"; "settings.translation.user-api-key" = "DeepL APIキー";
"settings.translation.api-key-type" = "キーのタイプ"; "settings.translation.api-key-type" = "キーのタイプ";
"settings.translation.needed-message" = "この機能には DeepL APIキーが必要です"; "settings.translation.needed-message" = "この機能には DeepL APIキーが必要です";

View file

@ -168,6 +168,8 @@
"settings.general.translate" = "번역 설정"; "settings.general.translate" = "번역 설정";
"settings.translation.navigation-title" = "번역 설정"; "settings.translation.navigation-title" = "번역 설정";
"settings.translation.always-deepl" = "항상 DeepL을 통해 번역"; "settings.translation.always-deepl" = "항상 DeepL을 통해 번역";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API 키"; "settings.translation.user-api-key" = "DeepL API 키";
"settings.translation.api-key-type" = "API 키 종류"; "settings.translation.api-key-type" = "API 키 종류";
"settings.translation.needed-message" = "이 기능을 사용하려면 DeepL에서 발급받은 API 키가 있어야 합니다."; "settings.translation.needed-message" = "이 기능을 사용하려면 DeepL에서 발급받은 API 키가 있어야 합니다.";

View file

@ -173,6 +173,8 @@
"settings.general.translate" = "Oversettelsesinnstillinger"; "settings.general.translate" = "Oversettelsesinnstillinger";
"settings.translation.navigation-title" = "Oversettelse"; "settings.translation.navigation-title" = "Oversettelse";
"settings.translation.always-deepl" = "Oversett alltid med DeepL"; "settings.translation.always-deepl" = "Oversett alltid med DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API-nøkkel"; "settings.translation.user-api-key" = "DeepL API-nøkkel";
"settings.translation.api-key-type" = "Type nøkkel"; "settings.translation.api-key-type" = "Type nøkkel";
"settings.translation.needed-message" = "Denne funksjonen krever en DeepL API-nøkkel"; "settings.translation.needed-message" = "Denne funksjonen krever en DeepL API-nøkkel";

View file

@ -144,6 +144,8 @@
"settings.general.translate" = "Vertalingsinstellingen"; "settings.general.translate" = "Vertalingsinstellingen";
"settings.translation.navigation-title" = "Vertaling"; "settings.translation.navigation-title" = "Vertaling";
"settings.translation.always-deepl" = "Vertaal altijd met DeepL"; "settings.translation.always-deepl" = "Vertaal altijd met DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API-sleutel"; "settings.translation.user-api-key" = "DeepL API-sleutel";
"settings.translation.api-key-type" = "Sleuteltype"; "settings.translation.api-key-type" = "Sleuteltype";
"settings.translation.needed-message" = "Deze functionaliteit vereist een DeepL API-sleutel"; "settings.translation.needed-message" = "Deze functionaliteit vereist een DeepL API-sleutel";

View file

@ -169,6 +169,8 @@
"settings.general.translate" = "Ustawienia tłumaczenia"; "settings.general.translate" = "Ustawienia tłumaczenia";
"settings.translation.navigation-title" = "Ustawienia tłumaczenia"; "settings.translation.navigation-title" = "Ustawienia tłumaczenia";
"settings.translation.always-deepl" = "Zawsze tłumacz przy pomocy DeepL"; "settings.translation.always-deepl" = "Zawsze tłumacz przy pomocy DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "Klucz DeepL API"; "settings.translation.user-api-key" = "Klucz DeepL API";
"settings.translation.api-key-type" = "Rodzaj klucza"; "settings.translation.api-key-type" = "Rodzaj klucza";
"settings.translation.needed-message" = "Ta funkcja wymaga klucza DeepL API"; "settings.translation.needed-message" = "Ta funkcja wymaga klucza DeepL API";

View file

@ -168,6 +168,8 @@
"settings.general.translate" = "Ajustes de Tradução"; "settings.general.translate" = "Ajustes de Tradução";
"settings.translation.navigation-title" = "Tradução"; "settings.translation.navigation-title" = "Tradução";
"settings.translation.always-deepl" = "Sempre traduzir utilizando DeepL"; "settings.translation.always-deepl" = "Sempre traduzir utilizando DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "Chave da API DeepL"; "settings.translation.user-api-key" = "Chave da API DeepL";
"settings.translation.api-key-type" = "Tipo da chave"; "settings.translation.api-key-type" = "Tipo da chave";
"settings.translation.needed-message" = "Esta funcionalidade requer uma chave de API DeepL"; "settings.translation.needed-message" = "Esta funcionalidade requer uma chave de API DeepL";

View file

@ -168,6 +168,8 @@
"settings.general.translate" = "Translation Settings"; "settings.general.translate" = "Translation Settings";
"settings.translation.navigation-title" = "Translation"; "settings.translation.navigation-title" = "Translation";
"settings.translation.always-deepl" = "Always Translate using DeepL"; "settings.translation.always-deepl" = "Always Translate using DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API Key"; "settings.translation.user-api-key" = "DeepL API Key";
"settings.translation.api-key-type" = "Type of the Key"; "settings.translation.api-key-type" = "Type of the Key";
"settings.translation.needed-message" = "This feature requires a DeepL API key"; "settings.translation.needed-message" = "This feature requires a DeepL API key";

View file

@ -173,6 +173,8 @@
"settings.general.translate" = "Налаштування перекладу"; "settings.general.translate" = "Налаштування перекладу";
"settings.translation.navigation-title" = "Переклад"; "settings.translation.navigation-title" = "Переклад";
"settings.translation.always-deepl" = "Завжди перекладати за допомогою DeepL"; "settings.translation.always-deepl" = "Завжди перекладати за допомогою DeepL";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API Key"; "settings.translation.user-api-key" = "DeepL API Key";
"settings.translation.api-key-type" = "Тип ключа"; "settings.translation.api-key-type" = "Тип ключа";
"settings.translation.needed-message" = "Ця функція потребує ключа DeepL API key"; "settings.translation.needed-message" = "Ця функція потребує ключа DeepL API key";

View file

@ -144,6 +144,8 @@
"settings.general.translate" = "翻译设置"; "settings.general.translate" = "翻译设置";
"settings.translation.navigation-title" = "翻译设置"; "settings.translation.navigation-title" = "翻译设置";
"settings.translation.always-deepl" = "总是使用 DeepL 翻译"; "settings.translation.always-deepl" = "总是使用 DeepL 翻译";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API 密钥"; "settings.translation.user-api-key" = "DeepL API 密钥";
"settings.translation.api-key-type" = "密钥类型"; "settings.translation.api-key-type" = "密钥类型";
"settings.translation.needed-message" = "该功能需要 DeepL API 密钥"; "settings.translation.needed-message" = "该功能需要 DeepL API 密钥";

View file

@ -217,6 +217,8 @@
"settings.general.translate" = "翻譯設定"; "settings.general.translate" = "翻譯設定";
"settings.translation.navigation-title" = "翻譯設定"; "settings.translation.navigation-title" = "翻譯設定";
"settings.translation.always-deepl" = "一概用 DeepL 翻譯"; "settings.translation.always-deepl" = "一概用 DeepL 翻譯";
"settings.translation.auto-detect-post-language" = "Auto detect language";
"settings.translation.auto-detect-post-language-footer" = "Ice Cubes will try to automatically detect the language of the post you're about to post and will suggest to update your post language if necessary.";
"settings.translation.user-api-key" = "DeepL API Key"; "settings.translation.user-api-key" = "DeepL API Key";
"settings.translation.api-key-type" = "Key 類型"; "settings.translation.api-key-type" = "Key 類型";
"settings.translation.needed-message" = "本功能需有 DeepL API key"; "settings.translation.needed-message" = "本功能需有 DeepL API key";

View file

@ -28,6 +28,7 @@ public class UserPreferences: ObservableObject {
@AppStorage("autoplay_video") public var autoPlayVideo = true @AppStorage("autoplay_video") public var autoPlayVideo = true
@AppStorage("always_use_deepl") public var alwaysUseDeepl = false @AppStorage("always_use_deepl") public var alwaysUseDeepl = false
@AppStorage("user_deepl_api_free") public var userDeeplAPIFree = true @AppStorage("user_deepl_api_free") public var userDeeplAPIFree = true
@AppStorage("auto_detect_post_language") public var autoDetectPostLanguage = true
@AppStorage("suppress_dupe_reblogs") public var suppressDupeReblogs: Bool = false @AppStorage("suppress_dupe_reblogs") public var suppressDupeReblogs: Bool = false

View file

@ -108,7 +108,7 @@ public struct StatusEditorView: View {
Button { Button {
Task { Task {
viewModel.evaluateLanguages() viewModel.evaluateLanguages()
if let _ = viewModel.languageConfirmationDialogLanguages { if preferences.autoDetectPostLanguage, let _ = viewModel.languageConfirmationDialogLanguages {
isLanguageConfirmPresented = true isLanguageConfirmPresented = true
} else { } else {
await postStatus() await postStatus()