diff --git a/i18n/cs/camera.ftl b/i18n/cs/camera.ftl index 7668ac8..37fbcb5 100644 --- a/i18n/cs/camera.ftl +++ b/i18n/cs/camera.ftl @@ -311,7 +311,7 @@ metainfo-description-usage = Otevřete aplikaci a začněte zachycovat okamžiky metainfo-description-features-title = Klíčové funkce: metainfo-feature-capture = Pořizování fotografií a videí: vysoká kvalita a hardwarová akcelerace metainfo-feature-qr = Skener QR kódů: otevírání odkazů, připojení k Wi-Fi a další -metainfo-feature-filters = 14 kreativních filtrů: Černobílý, Sépie, Živý, Noir, Skica a další +metainfo-feature-filters = 14 kreativních filtrů: { filter-mono }, { filter-sepia }, { filter-vivid }, { filter-noir }, { filter-pencil } a další metainfo-feature-virtual-camera = Virtuální kamera: používejte filtrovaný obraz kamery při videohovorech a v dalších aplikacích metainfo-feature-multi-camera = Podpora více kamer: snadné přepínání mezi kamerami a mikrofony metainfo-caption-photo-tools = Režim fotografie s nabídkou nástrojů diff --git a/i18n/en/camera.ftl b/i18n/en/camera.ftl index cd689d8..3ee5848 100644 --- a/i18n/en/camera.ftl +++ b/i18n/en/camera.ftl @@ -748,9 +748,9 @@ metainfo-feature-modes = Photo, video and timelapse modes, with a self timer and metainfo-feature-controls = Manual controls: exposure, ISO, shutter, focus and white balance # Feature list item. QR and WiFi are product names and stay as they are. metainfo-feature-qr = QR code scanner: open links, connect to WiFi, and more -# Feature list item. The filter names are the same ones used in the app, so -# translate them the same way there. -metainfo-feature-filters = 14 creative filters: Mono, Sepia, Vivid, Noir, Pencil Sketch, and more +# Feature list item. The filter names are pulled straight from the filter +# picker above, so translate them there and they follow here on their own. +metainfo-feature-filters = 14 creative filters: { filter-mono }, { filter-sepia }, { filter-vivid }, { filter-noir }, { filter-pencil }, and more # Feature list item. metainfo-feature-virtual-camera = Virtual camera: use your filtered camera feed in video calls and other apps # Feature list item. diff --git a/resources/io.github.cosmic_utils.camera.metainfo.xml b/resources/io.github.cosmic_utils.camera.metainfo.xml index b88c156..c3f77a0 100644 --- a/resources/io.github.cosmic_utils.camera.metainfo.xml +++ b/resources/io.github.cosmic_utils.camera.metainfo.xml @@ -39,7 +39,7 @@
  • Skener QR kódů: otevírání odkazů, připojení k Wi-Fi a další
  • Сканер QR-кодів: відкривайте посилання, підключайтеся до Wi-Fi та багато іншого
  • 二维码扫描器:打开链接、连接 WiFi 等
  • -
  • 14 creative filters: Mono, Sepia, Vivid, Noir, Pencil Sketch, and more
  • +
  • 14 creative filters: Mono, Sepia, Vivid, Noir, Pencil, and more
  • 14 kreativních filtrů: Černobílý, Sépie, Živý, Noir, Skica a další
  • Virtual camera: use your filtered camera feed in video calls and other apps
  • Virtuální kamera: používejte filtrovaný obraz kamery při videohovorech a v dalších aplikacích
  • diff --git a/scripts/gen-metadata.py b/scripts/gen-metadata.py index da21c0f..c2bbe3a 100755 --- a/scripts/gen-metadata.py +++ b/scripts/gen-metadata.py @@ -34,10 +34,6 @@ # 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": "camera", @@ -82,14 +78,18 @@ def read_translations() -> dict[str, dict[str, str]]: - """Return {fluent_key: {lang: value}} for the metadata keys of every language.""" + """Return {fluent_key: {lang: value}} for every string of every language. + + In-app keys are read too, not just the metadata ones: the metadata maps + some of them directly (`camera` becomes the launcher name) and references + others inside its own strings, so they all have to be resolvable. + """ out: dict[str, dict[str, str]] = {} for path in sorted(I18N.glob("*/camera.ftl")): 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) - or match.group(1) in SHARED_KEYS): + if match: out.setdefault(match.group(1), {})[lang] = match.group(2).strip() return out @@ -230,10 +230,13 @@ def main() -> int: if not translations: sys.exit(f"error: no metadata strings found in {I18N.relative_to(ROOT)}/*/camera.ftl") - source_keys = {k for k, v in translations.items() if SOURCE_LANG in v} expected = set(DESKTOP_KEYS.values()) for mapping in (METAINFO_HEAD, METAINFO_DESCRIPTION, METAINFO_SCREENSHOTS): expected.update(k for keys in mapping.values() for k in keys) + # Only the prefixed keys and the mapped ones are this script's business; + # the rest of the file is the application's own strings. + source_keys = {k for k, v in translations.items() if SOURCE_LANG in v + and (k.startswith(KEY_PREFIXES) or k in expected)} if missing := expected - source_keys: sys.exit(f"error: missing from i18n/{SOURCE_LANG}/camera.ftl: {', '.join(sorted(missing))}") if extra := source_keys - expected: @@ -241,7 +244,9 @@ def main() -> int: resolve_references(translations) - langs = sorted({lang for v in translations.values() for lang in v if lang != SOURCE_LANG}) + langs = sorted({lang for v in translations.values() for lang in v + if lang != SOURCE_LANG and any( + lang in translations[k] for k in expected)}) print(f"Generating metadata for: {', '.join(langs)}") write_if_changed(DESKTOP, render_desktop(translations, DESKTOP.read_text(encoding="utf-8")))