Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions i18n/bg/camera.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app-title = Камера
camera = Камера
about = Относно
repository = Хранилище

Expand All @@ -19,7 +19,6 @@ filters-title = Филтри

# Settings
settings-title = Настройки
settings-camera = Камера
settings-video = Видео
settings-device = Устройство
settings-microphone = Микрофон
Expand Down
7 changes: 1 addition & 6 deletions i18n/cs/camera.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app-title = Kamera
camera = Kamera
about = O aplikaci
repository = Repozitář
# Mode switcher
Expand All @@ -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
Expand Down Expand Up @@ -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í
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions i18n/de/camera.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app-title = Kamera
camera = Kamera
about = Über
repository = Repository
# Mode switcher
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
21 changes: 7 additions & 14 deletions i18n/en/camera.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions i18n/es/camera.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app-title = Cámara
camera = Cámara
about = Acerca de
repository = Repositorio
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions i18n/fr/camera.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app-title = Caméra
camera = Caméra
about = À propos
repository = Dépôt
# Sélecteur de mode
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions i18n/sv/camera.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app-title = Kamera
camera = Kamera
about = Om
repository = Källkod
# Lägesväxlare
Expand All @@ -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
Expand Down
8 changes: 2 additions & 6 deletions i18n/uk/camera.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app-title = Камера
camera = Камера
about = Про «Камеру»
repository = Сховище
# Mode switcher
Expand All @@ -24,7 +24,6 @@ dark = Темна
light = Світла
settings-default-mode = Режим камери
settings-default-mode-description = Типовий режим під час запуску застосунку
settings-camera = Камера
settings-video = Відео
settings-device = Пристрій
settings-microphone = Мікрофон
Expand Down Expand Up @@ -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 = Масштаб і кадрування
Expand Down Expand Up @@ -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 = Знімки та відеозйомка: висока якість і апаратне прискорення
Expand Down
8 changes: 2 additions & 6 deletions i18n/zh-CN/camera.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app-title = 相机
camera = 相机
about = 关于
repository = 代码仓库
# Mode switcher
Expand All @@ -21,7 +21,6 @@ settings-theme = 主题
match-desktop = 跟随桌面
dark = 深色
light = 浅色
settings-camera = 相机
settings-video = 视频
settings-device = 设备
settings-microphone = 麦克风
Expand Down Expand Up @@ -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 = 照片和视频捕捉:高质量且支持硬件加速
Expand Down
10 changes: 10 additions & 0 deletions resources/io.github.cosmic_utils.camera.desktop
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions resources/io.github.cosmic_utils.camera.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-only</project_license>
<name>Camera</name>
<name xml:lang="bg">Камера</name>
<name xml:lang="cs">Kamera</name>
<name xml:lang="de">Kamera</name>
<name xml:lang="es">Cámara</name>
<name xml:lang="fr">Caméra</name>
<name xml:lang="sv">Kamera</name>
<name xml:lang="uk">Камера</name>
<name xml:lang="zh-CN">相机</name>
<summary>Capture photos and videos</summary>
<summary xml:lang="cs">Pořizujte fotografie a videa</summary>
Expand Down
39 changes: 35 additions & 4 deletions scripts/gen-metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,22 @@
# 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",
}

# 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 = {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)}")

Expand Down
2 changes: 1 addition & 1 deletion src/app/keybind/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions src/app/settings/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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,
))
Expand Down Expand Up @@ -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(),
]))
Expand Down
Loading