diff --git a/i18n/bg/camera.ftl b/i18n/bg/camera.ftl index f01173a..25e9d4b 100644 --- a/i18n/bg/camera.ftl +++ b/i18n/bg/camera.ftl @@ -1,4 +1,4 @@ -app-title = Камера +camera = Камера about = Относно repository = Хранилище @@ -19,7 +19,6 @@ filters-title = Филтри # Settings settings-title = Настройки -settings-camera = Камера settings-video = Видео settings-device = Устройство settings-microphone = Микрофон diff --git a/i18n/cs/camera.ftl b/i18n/cs/camera.ftl index c5bfba6..2defcec 100644 --- a/i18n/cs/camera.ftl +++ b/i18n/cs/camera.ftl @@ -1,4 +1,4 @@ -app-title = Kamera +camera = Kamera about = O aplikaci repository = Repozitář # Mode switcher @@ -24,7 +24,6 @@ dark = Tmavý light = Světlý settings-default-mode = Výchozí režim settings-default-mode-description = Režim kamery při spuštění aplikace -settings-camera = Kamera settings-video = Video settings-device = Zařízení settings-microphone = Mikrofon @@ -278,7 +277,6 @@ keybindings-page-title = Klávesové zkratky shortcuts-help-unbound = — shortcut-category-display = Zobrazení shortcut-category-pickers = Nástroje výběru -shortcut-category-camera = Kamera settings-mic-level-initializing = Inicializace… settings-mic-level = Úroveň mikrofonu settings-overlay-effect = Efekt překrytí @@ -307,11 +305,8 @@ filter-pencil = Skica ptz-pan = Otočení ptz-tilt = Náklon -desktop-name = Kamera -desktop-generic-name = Kamera desktop-comment = Aplikace kamery pro prostředí COSMIC™ desktop-keywords = kamera;fotoaparát;webkamera;fotografie;video; -metainfo-name = Kamera metainfo-summary = Pořizujte fotografie a videa metainfo-description-intro = Aplikace kamery od třetí strany pro prostředí COSMIC™. Ať už potřebujete rychle pořídit fotografii, nahrát video nebo naskenovat QR kód, aplikace nabízí čisté a intuitivní rozhraní, které vám rozhodně nebude překážet. metainfo-description-usage = Otevřete aplikaci a začněte zachycovat okamžiky. Přidejte zábavné filtry ke svým fotografiím, skenujte QR kódy pro otevření odkazů nebo připojení k Wi-Fi, případně použijte režim virtuální kamery, abyste při videohovorech vypadali skvěle s aplikovaným oblíbeným filtrem. diff --git a/i18n/de/camera.ftl b/i18n/de/camera.ftl index b930c21..e6d448e 100644 --- a/i18n/de/camera.ftl +++ b/i18n/de/camera.ftl @@ -1,4 +1,4 @@ -app-title = Kamera +camera = Kamera about = Über repository = Repository # Mode switcher @@ -22,7 +22,6 @@ settings-theme = Design match-desktop = An Desktop anpassen dark = Dunkel light = Hell -settings-camera = Kamera settings-video = Video settings-device = Gerät settings-microphone = Mikrofon @@ -237,7 +236,6 @@ insights-capture = Aufnahme insights-capture-burst = Serienaufnahme # Keyboard shortcuts — categories (placeholder, needs translation) shortcut-category-capture = Aufnahme -shortcut-category-camera = Camera shortcut-category-pickers = Auswahlmenüs shortcut-category-display = Anzeige shortcut-category-zoom = Zoom & Bildausschnitt diff --git a/i18n/en/camera.ftl b/i18n/en/camera.ftl index bed5b06..532107d 100644 --- a/i18n/en/camera.ftl +++ b/i18n/en/camera.ftl @@ -7,8 +7,12 @@ ### Product names (COSMIC, PipeWire, GStreamer, libcamera, V4L2, DNG, JPEG, PNG, ### HDR+, Opus, AAC, MJPEG, NV12) are not translated. -# Application name, shown in the About page header and the window title. -app-title = Camera +# The word "Camera", used for every place the app names itself or a camera +# device: the window title and About page header, the launcher and software +# centre entry, the camera settings page, and the camera shortcut category. It +# is also referenced inside longer strings as { camera }, so keep it a single +# noun that reads correctly at the start of a sentence. +camera = Camera # Row that opens the About page, and the label of the F1 shortcut. Reused in # both places, so it has to work as a navigation row and as an action name. about = About @@ -115,8 +119,6 @@ overlay-effect-off = Off settings-default-mode = Default mode # Description under the default mode dropdown. settings-default-mode-description = Camera mode to use when the app launches -# Settings row, page title and section title for camera device options. -settings-camera = Camera # Settings row, page title and section title for video recording options. settings-video = Video # Label of the camera selection row. This row also holds an info button and the @@ -634,8 +636,6 @@ insights-capture-burst = Capture Burst # Groups the shutter and snapshot shortcuts. shortcut-category-capture = Capture -# Groups camera switching, focus and flash shortcuts. -shortcut-category-camera = Camera # Groups the shortcuts that open the exposure, colour, motor, format and # settings panels. shortcut-category-pickers = Pickers @@ -720,11 +720,6 @@ keybindings-record-save = Save ## are the only strings here that are not shown inside the application itself. ## The trademark sign in COSMIC™ must be kept. -# Application name in the launcher. Keep it short, it appears under the icon. -desktop-name = Camera -# Generic description of the application type, shown by some launchers instead -# of, or alongside, the name above. -desktop-generic-name = Camera # One line tooltip shown in the launcher. desktop-comment = Third-party camera app for the COSMIC™ desktop # Search terms for the launcher, separated by semicolons and ending with one. @@ -736,13 +731,11 @@ desktop-keywords = camera;webcam;photo;video; ## Software centre listing, shown by GNOME Software, KDE Discover and Flathub. ## The release notes in the metainfo file are deliberately not translated. -# Application name in software centres. Should match the launcher name above. -metainfo-name = Camera # One line summary shown under the name in a software centre. Keep it under # about 60 characters, as listings truncate it. metainfo-summary = Capture photos and videos # First paragraph of the long description. -metainfo-description-intro = Camera is a third-party camera application for the COSMIC™ desktop environment. Whether you need to snap a quick photo, record a video, or scan a QR code, Camera provides a clean and intuitive interface that stays out of your way. +metainfo-description-intro = { camera } is a third-party camera application for the COSMIC™ desktop environment. Whether you need to snap a quick photo, record a video, or scan a QR code, { camera } provides a clean and intuitive interface that stays out of your way. # Second paragraph of the long description. metainfo-description-usage = Just open the app and start capturing moments. Add fun filters to your photos, scan QR codes to open links or connect to WiFi, or use virtual camera mode to look great in video calls with your favorite filter applied. # Heading introducing the feature list below. Ends with a colon. diff --git a/i18n/es/camera.ftl b/i18n/es/camera.ftl index 201f637..3e0563d 100644 --- a/i18n/es/camera.ftl +++ b/i18n/es/camera.ftl @@ -1,4 +1,4 @@ -app-title = Cámara +camera = Cámara about = Acerca de repository = Repositorio @@ -24,7 +24,6 @@ settings-theme = Tema match-desktop = Coincidir con el escritorio dark = Oscuro light = Claro -settings-camera = Cámara settings-video = Video settings-device = Dispositivo settings-microphone = Micrófono diff --git a/i18n/fr/camera.ftl b/i18n/fr/camera.ftl index 895f317..4234497 100644 --- a/i18n/fr/camera.ftl +++ b/i18n/fr/camera.ftl @@ -1,4 +1,4 @@ -app-title = Caméra +camera = Caméra about = À propos repository = Dépôt # Sélecteur de mode @@ -24,7 +24,6 @@ dark = Sombre light = Clair settings-default-mode = Mode par défaut settings-default-mode-description = Mode caméra à utiliser au lancement de l'application -settings-camera = Caméra settings-video = Vidéo settings-device = Périphérique settings-microphone = Microphone @@ -280,7 +279,6 @@ action-toggle-flash = Activer/désactiver le flash action-toggle-focus-auto = Activer/désactiver la mise au point automatique action-toggle-format-picker = Activer/désactiver le sélecteur de format action-toggle-settings = Ouvrir les paramètres -shortcut-category-camera = Caméra shortcut-category-pickers = Sélecteurs shortcut-category-display = Affichage shortcut-category-capture = Capture diff --git a/i18n/sv/camera.ftl b/i18n/sv/camera.ftl index 3a0182c..d0996ef 100644 --- a/i18n/sv/camera.ftl +++ b/i18n/sv/camera.ftl @@ -1,4 +1,4 @@ -app-title = Kamera +camera = Kamera about = Om repository = Källkod # Lägesväxlare @@ -22,7 +22,6 @@ dark = Mörkt light = Ljust settings-default-mode = Standard läge settings-default-mode-description = Kamera läge att använda när programmet startar -settings-camera = Kamera settings-video = Video settings-device = Enhet settings-microphone = Mikrofon diff --git a/i18n/uk/camera.ftl b/i18n/uk/camera.ftl index cf1467f..ab7b8a0 100644 --- a/i18n/uk/camera.ftl +++ b/i18n/uk/camera.ftl @@ -1,4 +1,4 @@ -app-title = Камера +camera = Камера about = Про «Камеру» repository = Сховище # Mode switcher @@ -24,7 +24,6 @@ dark = Темна light = Світла settings-default-mode = Режим камери settings-default-mode-description = Типовий режим під час запуску застосунку -settings-camera = Камера settings-video = Відео settings-device = Пристрій settings-microphone = Мікрофон @@ -244,7 +243,6 @@ insights-capture = Зйомка insights-capture-burst = Серійна зйомка # Keyboard shortcuts — categories shortcut-category-capture = Зйомка -shortcut-category-camera = Камера shortcut-category-pickers = Вибір параметрів shortcut-category-display = Дисплей shortcut-category-zoom = Масштаб і кадрування @@ -280,12 +278,10 @@ keybindings-record-replace = Замінити keybindings-record-cancel = Скасувати keybindings-record-save = Зберегти -desktop-name = Камера -desktop-generic-name = Камера desktop-comment = Застосунок камери для середовища COSMIC™ desktop-keywords = камера;kamera;camera;вебкамера;знімок;фото;видиво;відео;запис;космік;photo;video; metainfo-summary = Знімайте фото та відео -metainfo-description-intro = Камера — це сторонній застосунок камери для середовища COSMIC™. Потрібно швидко зробити знімок, записати відео чи відсканувати QR-код? Камера пропонує чистий, інтуїтивний інтерфейс, який не плутатиме вас. +metainfo-description-intro = { camera } — це сторонній застосунок камери для середовища COSMIC™. Потрібно швидко зробити знімок, записати відео чи відсканувати QR-код? { camera } пропонує чистий, інтуїтивний інтерфейс, який не плутатиме вас. metainfo-description-usage = Просто відкрийте застосунок і починайте творити. Застосовуйте креативні фільтри до знімків, миттєво скануйте QR-коди для переходу за посиланнями чи підключення до Wi-Fi, або скористайтеся режимом віртуальної камери, щоб виглядати бездоганно у відеодзвінках з улюбленим фільтром. metainfo-description-features-title = Основні можливості: metainfo-feature-capture = Знімки та відеозйомка: висока якість і апаратне прискорення diff --git a/i18n/zh-CN/camera.ftl b/i18n/zh-CN/camera.ftl index d715b43..c34d005 100644 --- a/i18n/zh-CN/camera.ftl +++ b/i18n/zh-CN/camera.ftl @@ -1,4 +1,4 @@ -app-title = 相机 +camera = 相机 about = 关于 repository = 代码仓库 # Mode switcher @@ -21,7 +21,6 @@ settings-theme = 主题 match-desktop = 跟随桌面 dark = 深色 light = 浅色 -settings-camera = 相机 settings-video = 视频 settings-device = 设备 settings-microphone = 麦克风 @@ -230,13 +229,10 @@ settings-timelapse-interval-description = 连续照片拍摄之间的时间间 insights-capture = 捕捉 insights-capture-burst = 连拍捕捉 -desktop-name = 相机 -desktop-generic-name = 相机 desktop-comment = COSMIC™ 桌面的第三方相机应用 desktop-keywords = 相机;摄像头;照片;视频; -metainfo-name = 相机 metainfo-summary = 拍摄照片和视频 -metainfo-description-intro = 相机是 COSMIC™ 桌面环境的第三方相机应用程序。 无论您需要快速拍照、录制视频还是扫描二维码, 相机都提供简洁直观的界面,不会妨碍您的操作。 +metainfo-description-intro = { camera }是 COSMIC™ 桌面环境的第三方相机应用程序。 无论您需要快速拍照、录制视频还是扫描二维码, { camera }都提供简洁直观的界面,不会妨碍您的操作。 metainfo-description-usage = 只需打开应用程序即可开始捕捉精彩瞬间。 为照片添加有趣的滤镜,扫描二维码打开链接或连接 WiFi, 或使用虚拟相机模式在视频通话中应用您喜爱的滤镜,展现最佳状态。 metainfo-description-features-title = 主要功能: metainfo-feature-capture = 照片和视频捕捉:高质量且支持硬件加速 diff --git a/resources/io.github.cosmic_utils.camera.desktop b/resources/io.github.cosmic_utils.camera.desktop index 99cc3bb..b447171 100644 --- a/resources/io.github.cosmic_utils.camera.desktop +++ b/resources/io.github.cosmic_utils.camera.desktop @@ -1,11 +1,21 @@ [Desktop Entry] Type=Application Name=Camera +Name[bg]=Камера Name[cs]=Kamera +Name[de]=Kamera +Name[es]=Cámara +Name[fr]=Caméra +Name[sv]=Kamera Name[uk]=Камера Name[zh_CN]=相机 GenericName=Camera +GenericName[bg]=Камера GenericName[cs]=Kamera +GenericName[de]=Kamera +GenericName[es]=Cámara +GenericName[fr]=Caméra +GenericName[sv]=Kamera GenericName[uk]=Камера GenericName[zh_CN]=相机 Comment=Third-party camera app for the COSMIC™ desktop diff --git a/resources/io.github.cosmic_utils.camera.metainfo.xml b/resources/io.github.cosmic_utils.camera.metainfo.xml index 6340567..5ae1e70 100644 --- a/resources/io.github.cosmic_utils.camera.metainfo.xml +++ b/resources/io.github.cosmic_utils.camera.metainfo.xml @@ -4,7 +4,13 @@ CC0-1.0 GPL-3.0-only Camera + Камера Kamera + Kamera + Cámara + Caméra + Kamera + Камера 相机 Capture photos and videos Pořizujte fotografie a videa diff --git a/scripts/gen-metadata.py b/scripts/gen-metadata.py index 3795956..30eb426 100755 --- a/scripts/gen-metadata.py +++ b/scripts/gen-metadata.py @@ -34,10 +34,14 @@ # the ones generated from here. These prefixes mark the latter. KEY_PREFIXES = ("desktop-", "metainfo-") +# In-app keys the metadata reuses instead of duplicating, either as a value of +# their own or through a { key } reference inside another string. +SHARED_KEYS = ("camera",) + # Desktop entry key -> Fluent key. DESKTOP_KEYS = { - "Name": "desktop-name", - "GenericName": "desktop-generic-name", + "Name": "camera", + "GenericName": "camera", "Comment": "desktop-comment", "Keywords": "desktop-keywords", } @@ -45,7 +49,7 @@ # Metainfo elements, in document order within their region, mapped to Fluent # keys. The nth English (untagged) element of each kind takes the nth key. METAINFO_HEAD = { - "name": ["metainfo-name"], + "name": ["camera"], "summary": ["metainfo-summary"], } METAINFO_DESCRIPTION = { @@ -81,11 +85,36 @@ def read_translations() -> dict[str, dict[str, str]]: lang = path.parent.name for line in path.read_text(encoding="utf-8").splitlines(): match = re.match(r"^([a-z0-9-]+) = (.*)$", line) - if match and match.group(1).startswith(KEY_PREFIXES): + if match and (match.group(1).startswith(KEY_PREFIXES) + or match.group(1) in SHARED_KEYS): out.setdefault(match.group(1), {})[lang] = match.group(2).strip() return out +def resolve_references(translations: dict[str, dict[str, str]]) -> None: + """Expand { key } placeables in place, falling back to the source language. + + Fluent resolves these itself for the strings the application renders, but + the desktop and metainfo files are plain text, so they need the final value. + """ + reference = re.compile(r"\{\s*([a-z0-9-]+)\s*\}") + + def expand(key: str, lang: str, seen: frozenset[str]) -> str: + if key in seen: + sys.exit(f"error: circular reference to {{ {key} }} in i18n/{lang}/camera.ftl") + values = translations.get(key) + if not values: + sys.exit(f"error: unknown reference {{ {key} }} in i18n/{lang}/camera.ftl") + value = values.get(lang, values.get(SOURCE_LANG, "")) + return reference.sub( + lambda m: expand(m.group(1), lang, seen | {key}), value + ) + + for key, values in translations.items(): + for lang in values: + values[lang] = expand(key, lang, frozenset()) + + def langs_for(translations: dict[str, dict[str, str]], key: str) -> list[str]: """Translated languages for a key, source language excluded, sorted.""" return sorted(lang for lang in translations.get(key, {}) if lang != SOURCE_LANG) @@ -201,6 +230,8 @@ def main() -> int: if extra := source_keys - expected: sys.exit(f"error: unmapped keys in i18n/{SOURCE_LANG}/camera.ftl: {', '.join(sorted(extra))}") + resolve_references(translations) + langs = sorted({lang for v in translations.values() for lang in v if lang != SOURCE_LANG}) print(f"Generating metadata for: {', '.join(langs)}") diff --git a/src/app/keybind/action.rs b/src/app/keybind/action.rs index 96456de..cd4e0a8 100644 --- a/src/app/keybind/action.rs +++ b/src/app/keybind/action.rs @@ -231,7 +231,7 @@ impl ActionCategory { use crate::fl; match self { ActionCategory::Capture => fl!("shortcut-category-capture"), - ActionCategory::Camera => fl!("shortcut-category-camera"), + ActionCategory::Camera => fl!("camera"), ActionCategory::Pickers => fl!("shortcut-category-pickers"), ActionCategory::Display => fl!("shortcut-category-display"), ActionCategory::Zoom => fl!("shortcut-category-zoom"), diff --git a/src/app/mod.rs b/src/app/mod.rs index 0f44b17..d93d9cf 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -254,7 +254,7 @@ impl cosmic::Application for AppModel { // Create the about widget let about = About::default() - .name(fl!("app-title")) + .name(fl!("camera")) .icon(widget::icon::from_raster_bytes(APP_ICON)) .version(env!("GIT_VERSION")) .author("Frederic Laing") diff --git a/src/app/settings/view.rs b/src/app/settings/view.rs index 8bb8a37..df318e3 100644 --- a/src/app/settings/view.rs +++ b/src/app/settings/view.rs @@ -40,7 +40,7 @@ impl AppModel { match self.settings_page { SettingsPage::Root => self.settings_root_view(), SettingsPage::Camera => { - self.settings_subpage(fl!("settings-camera"), self.camera_sections()) + self.settings_subpage(fl!("camera"), self.camera_sections()) } SettingsPage::Photo => { self.settings_subpage(fl!("settings-photo"), self.photo_sections()) @@ -80,7 +80,7 @@ impl AppModel { let categories = widget::list_column() .add(self.settings_nav_row( "camera-photo-symbolic", - fl!("settings-camera"), + fl!("camera"), Message::OpenSettingsPage(SettingsPage::Camera), true, )) @@ -267,7 +267,7 @@ impl AppModel { .width(Length::Fill); let mut camera_section = widget::settings::section() - .title(fl!("settings-camera")) + .title(fl!("camera")) .add(widget::settings::item_row(vec![ device_label_with_info.into(), ]))