From 2c9a4e07c6c014797cd8191d3c0b832eb5ab6358 Mon Sep 17 00:00:00 2001 From: Felix-Ayush <67006255+Ayush7614@users.noreply.github.com> Date: Sat, 1 Aug 2026 14:33:52 +0530 Subject: [PATCH] Localize hardcoded macOS image picker copy. (#1478) MacImagePickerView used English string literals, so it skipped the string catalog and localization coverage. Move the user-facing strings into Localizable.xcstrings for all supported locales. Co-authored-by: jack <212554440+jackjackbits@users.noreply.github.com> --- bitchat/Localizable.xcstrings | 744 ++++++++++++++++++ .../Image Viewers/MacImagePickerView.swift | 15 +- 2 files changed, 755 insertions(+), 4 deletions(-) diff --git a/bitchat/Localizable.xcstrings b/bitchat/Localizable.xcstrings index 8abd2d9a..ff2548c2 100644 --- a/bitchat/Localizable.xcstrings +++ b/bitchat/Localizable.xcstrings @@ -56015,6 +56015,750 @@ } } }, + "mac.image_picker.cancel" : { + "comment" : "Cancel button for the macOS image picker sheet", + "extractionState" : "manual", + "localizations" : { + "ar" : { + "stringUnit" : { + "state" : "translated", + "value" : "إلغاء" + } + }, + "bn" : { + "stringUnit" : { + "state" : "translated", + "value" : "বাতিল" + } + }, + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "Abbrechen" + } + }, + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Cancel" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "Cancelar" + } + }, + "fa" : { + "stringUnit" : { + "state" : "translated", + "value" : "لغو" + } + }, + "fil" : { + "stringUnit" : { + "state" : "translated", + "value" : "Cancel" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Annuler" + } + }, + "he" : { + "stringUnit" : { + "state" : "translated", + "value" : "ביטול" + } + }, + "hi" : { + "stringUnit" : { + "state" : "translated", + "value" : "रद्द करें" + } + }, + "id" : { + "stringUnit" : { + "state" : "translated", + "value" : "Batal" + } + }, + "it" : { + "stringUnit" : { + "state" : "translated", + "value" : "Annulla" + } + }, + "ja" : { + "stringUnit" : { + "state" : "translated", + "value" : "キャンセル" + } + }, + "ko" : { + "stringUnit" : { + "state" : "translated", + "value" : "취소" + } + }, + "ms" : { + "stringUnit" : { + "state" : "translated", + "value" : "Batal" + } + }, + "ne" : { + "stringUnit" : { + "state" : "translated", + "value" : "रद्द गर्नुहोस्" + } + }, + "nl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Annuleren" + } + }, + "pl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Anuluj" + } + }, + "pt" : { + "stringUnit" : { + "state" : "translated", + "value" : "Cancelar" + } + }, + "pt-BR" : { + "stringUnit" : { + "state" : "translated", + "value" : "Cancelar" + } + }, + "ru" : { + "stringUnit" : { + "state" : "translated", + "value" : "Отмена" + } + }, + "sv" : { + "stringUnit" : { + "state" : "translated", + "value" : "Avbryt" + } + }, + "ta" : { + "stringUnit" : { + "state" : "translated", + "value" : "ரத்துசெய்" + } + }, + "th" : { + "stringUnit" : { + "state" : "translated", + "value" : "ยกเลิก" + } + }, + "tr" : { + "stringUnit" : { + "state" : "translated", + "value" : "İptal" + } + }, + "uk" : { + "stringUnit" : { + "state" : "translated", + "value" : "Скасувати" + } + }, + "ur" : { + "stringUnit" : { + "state" : "translated", + "value" : "منسوخ" + } + }, + "vi" : { + "stringUnit" : { + "state" : "translated", + "value" : "Hủy" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "取消" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "取消" + } + } + } + }, + "mac.image_picker.panel_message" : { + "comment" : "Message shown in the macOS NSOpenPanel when picking an image", + "extractionState" : "manual", + "localizations" : { + "ar" : { + "stringUnit" : { + "state" : "translated", + "value" : "اختر صورة لإرسالها" + } + }, + "bn" : { + "stringUnit" : { + "state" : "translated", + "value" : "পাঠানোর জন্য একটি ছবি বেছে নিন" + } + }, + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "Wähle ein Bild zum Senden" + } + }, + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Choose an image to send" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "Elige una imagen para enviar" + } + }, + "fa" : { + "stringUnit" : { + "state" : "translated", + "value" : "تصویری برای ارسال انتخاب کنید" + } + }, + "fil" : { + "stringUnit" : { + "state" : "translated", + "value" : "Pumili ng larawang ipapadala" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Choisissez une image à envoyer" + } + }, + "he" : { + "stringUnit" : { + "state" : "translated", + "value" : "בחר תמונה לשליחה" + } + }, + "hi" : { + "stringUnit" : { + "state" : "translated", + "value" : "भेजने के लिए एक छवि चुनें" + } + }, + "id" : { + "stringUnit" : { + "state" : "translated", + "value" : "Pilih gambar untuk dikirim" + } + }, + "it" : { + "stringUnit" : { + "state" : "translated", + "value" : "Scegli un'immagine da inviare" + } + }, + "ja" : { + "stringUnit" : { + "state" : "translated", + "value" : "送信する画像を選択" + } + }, + "ko" : { + "stringUnit" : { + "state" : "translated", + "value" : "보낼 이미지 선택" + } + }, + "ms" : { + "stringUnit" : { + "state" : "translated", + "value" : "Pilih imej untuk dihantar" + } + }, + "ne" : { + "stringUnit" : { + "state" : "translated", + "value" : "पठाउनका लागि एउटा तस्बिर छान्नुहोस्" + } + }, + "nl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Kies een afbeelding om te versturen" + } + }, + "pl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Wybierz obraz do wysłania" + } + }, + "pt" : { + "stringUnit" : { + "state" : "translated", + "value" : "Escolher uma imagem para enviar" + } + }, + "pt-BR" : { + "stringUnit" : { + "state" : "translated", + "value" : "Escolha uma imagem para enviar" + } + }, + "ru" : { + "stringUnit" : { + "state" : "translated", + "value" : "Выберите изображение для отправки" + } + }, + "sv" : { + "stringUnit" : { + "state" : "translated", + "value" : "Välj en bild att skicka" + } + }, + "ta" : { + "stringUnit" : { + "state" : "translated", + "value" : "அனுப்ப ஒரு படத்தைத் தேர்ந்தெடுக்கவும்" + } + }, + "th" : { + "stringUnit" : { + "state" : "translated", + "value" : "เลือกภาพที่จะส่ง" + } + }, + "tr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Göndermek için bir görsel seçin" + } + }, + "uk" : { + "stringUnit" : { + "state" : "translated", + "value" : "Виберіть зображення для надсилання" + } + }, + "ur" : { + "stringUnit" : { + "state" : "translated", + "value" : "بھیجنے کے لیے ایک تصویر منتخب کریں" + } + }, + "vi" : { + "stringUnit" : { + "state" : "translated", + "value" : "Chọn một hình ảnh để gửi" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "选择要发送的图片" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "選擇要傳送的圖片" + } + } + } + }, + "mac.image_picker.select" : { + "comment" : "Button that opens the macOS open-panel to pick an image", + "extractionState" : "manual", + "localizations" : { + "ar" : { + "stringUnit" : { + "state" : "translated", + "value" : "تحديد صورة" + } + }, + "bn" : { + "stringUnit" : { + "state" : "translated", + "value" : "ছবি নির্বাচন করুন" + } + }, + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "Bild auswählen" + } + }, + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Select Image" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "Seleccionar imagen" + } + }, + "fa" : { + "stringUnit" : { + "state" : "translated", + "value" : "انتخاب تصویر" + } + }, + "fil" : { + "stringUnit" : { + "state" : "translated", + "value" : "Piliin ang Larawan" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Sélectionner une image" + } + }, + "he" : { + "stringUnit" : { + "state" : "translated", + "value" : "בחר תמונה" + } + }, + "hi" : { + "stringUnit" : { + "state" : "translated", + "value" : "छवि चुनें" + } + }, + "id" : { + "stringUnit" : { + "state" : "translated", + "value" : "Pilih Gambar" + } + }, + "it" : { + "stringUnit" : { + "state" : "translated", + "value" : "Seleziona immagine" + } + }, + "ja" : { + "stringUnit" : { + "state" : "translated", + "value" : "画像を選択" + } + }, + "ko" : { + "stringUnit" : { + "state" : "translated", + "value" : "이미지 선택" + } + }, + "ms" : { + "stringUnit" : { + "state" : "translated", + "value" : "Pilih Imej" + } + }, + "ne" : { + "stringUnit" : { + "state" : "translated", + "value" : "तस्बिर चयन गर्नुहोस्" + } + }, + "nl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Afbeelding selecteren" + } + }, + "pl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Wybierz obraz" + } + }, + "pt" : { + "stringUnit" : { + "state" : "translated", + "value" : "Selecionar imagem" + } + }, + "pt-BR" : { + "stringUnit" : { + "state" : "translated", + "value" : "Selecionar imagem" + } + }, + "ru" : { + "stringUnit" : { + "state" : "translated", + "value" : "Выбрать изображение" + } + }, + "sv" : { + "stringUnit" : { + "state" : "translated", + "value" : "Välj bild" + } + }, + "ta" : { + "stringUnit" : { + "state" : "translated", + "value" : "படத்தைத் தேர்ந்தெடு" + } + }, + "th" : { + "stringUnit" : { + "state" : "translated", + "value" : "เลือกภาพ" + } + }, + "tr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Görsel Seç" + } + }, + "uk" : { + "stringUnit" : { + "state" : "translated", + "value" : "Вибрати зображення" + } + }, + "ur" : { + "stringUnit" : { + "state" : "translated", + "value" : "تصویر منتخب کریں" + } + }, + "vi" : { + "stringUnit" : { + "state" : "translated", + "value" : "Chọn hình ảnh" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "选择图片" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "選擇圖片" + } + } + } + }, + "mac.image_picker.title" : { + "comment" : "Title shown in the macOS image picker sheet", + "extractionState" : "manual", + "localizations" : { + "ar" : { + "stringUnit" : { + "state" : "translated", + "value" : "اختر صورة" + } + }, + "bn" : { + "stringUnit" : { + "state" : "translated", + "value" : "একটি ছবি বেছে নিন" + } + }, + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "Bild auswählen" + } + }, + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Choose an image" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "Elige una imagen" + } + }, + "fa" : { + "stringUnit" : { + "state" : "translated", + "value" : "یک تصویر انتخاب کنید" + } + }, + "fil" : { + "stringUnit" : { + "state" : "translated", + "value" : "Pumili ng larawan" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Choisir une image" + } + }, + "he" : { + "stringUnit" : { + "state" : "translated", + "value" : "בחר תמונה" + } + }, + "hi" : { + "stringUnit" : { + "state" : "translated", + "value" : "एक छवि चुनें" + } + }, + "id" : { + "stringUnit" : { + "state" : "translated", + "value" : "Pilih gambar" + } + }, + "it" : { + "stringUnit" : { + "state" : "translated", + "value" : "Scegli un'immagine" + } + }, + "ja" : { + "stringUnit" : { + "state" : "translated", + "value" : "画像を選択" + } + }, + "ko" : { + "stringUnit" : { + "state" : "translated", + "value" : "이미지 선택" + } + }, + "ms" : { + "stringUnit" : { + "state" : "translated", + "value" : "Pilih imej" + } + }, + "ne" : { + "stringUnit" : { + "state" : "translated", + "value" : "एउटा तस्बिर छान्नुहोस्" + } + }, + "nl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Kies een afbeelding" + } + }, + "pl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Wybierz obraz" + } + }, + "pt" : { + "stringUnit" : { + "state" : "translated", + "value" : "Escolher uma imagem" + } + }, + "pt-BR" : { + "stringUnit" : { + "state" : "translated", + "value" : "Escolha uma imagem" + } + }, + "ru" : { + "stringUnit" : { + "state" : "translated", + "value" : "Выберите изображение" + } + }, + "sv" : { + "stringUnit" : { + "state" : "translated", + "value" : "Välj en bild" + } + }, + "ta" : { + "stringUnit" : { + "state" : "translated", + "value" : "ஒரு படத்தைத் தேர்ந்தெடுக்கவும்" + } + }, + "th" : { + "stringUnit" : { + "state" : "translated", + "value" : "เลือกภาพ" + } + }, + "tr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Bir görsel seçin" + } + }, + "uk" : { + "stringUnit" : { + "state" : "translated", + "value" : "Виберіть зображення" + } + }, + "ur" : { + "stringUnit" : { + "state" : "translated", + "value" : "ایک تصویر منتخب کریں" + } + }, + "vi" : { + "stringUnit" : { + "state" : "translated", + "value" : "Chọn một hình ảnh" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "选择图片" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "選擇圖片" + } + } + } + }, "media.accessibility.cancel_send" : { "comment" : "Accessibility label for the cancel button on an in-flight media send", "extractionState" : "manual", diff --git a/bitchat/Views/Image Viewers/MacImagePickerView.swift b/bitchat/Views/Image Viewers/MacImagePickerView.swift index 805d7495..1b88c7f2 100644 --- a/bitchat/Views/Image Viewers/MacImagePickerView.swift +++ b/bitchat/Views/Image Viewers/MacImagePickerView.swift @@ -14,18 +14,25 @@ struct MacImagePickerView: View { let completion: (URL?) -> Void @Environment(\.dismiss) private var dismiss + private enum Strings { + static let title: LocalizedStringKey = "mac.image_picker.title" + static let select = String(localized: "mac.image_picker.select", comment: "Button that opens the macOS open-panel to pick an image") + static let panelMessage = String(localized: "mac.image_picker.panel_message", comment: "Message shown in the macOS NSOpenPanel when picking an image") + static let cancel = String(localized: "mac.image_picker.cancel", comment: "Cancel button for the macOS image picker sheet") + } + var body: some View { VStack(spacing: 16) { - Text("Choose an image") + Text(Strings.title) .font(.headline) - Button("Select Image") { + Button(Strings.select) { let panel = NSOpenPanel() panel.allowsMultipleSelection = false panel.canChooseDirectories = false panel.canChooseFiles = true panel.allowedContentTypes = [.image, .png, .jpeg, .heic] - panel.message = "Choose an image to send" + panel.message = Strings.panelMessage if panel.runModal() == .OK { completion(panel.url) @@ -35,7 +42,7 @@ struct MacImagePickerView: View { } .buttonStyle(.borderedProminent) - Button("Cancel") { + Button(Strings.cancel) { completion(nil) } .buttonStyle(.bordered)