From 65d751c64ca32f1f6a45695c8763c286e55c5328 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Thu, 24 Sep 2026 15:44:00 +0800 Subject: [PATCH] fix: make clarification for Info.plist CFBundleLocalizations --- DEVNOTE.md | 1 + doc/render-context/plist.md | 2 ++ example/Info.plist.liquid | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/DEVNOTE.md b/DEVNOTE.md index 1e53f0b..797d3ba 100644 --- a/DEVNOTE.md +++ b/DEVNOTE.md @@ -44,6 +44,7 @@ Additionally, we check [the document about localization file path](https://learn macOS `.plist` and its localization mechanism involve multiple file formats. All formats of them can be browsed from their official documents: - `Info.plist` file: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/PropertyLists/UnderstandXMLPlist/UnderstandXMLPlist.html +- Available keys and values in `Info.plist` file: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html - `InfoPlist.strings` and other string resource files: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html - UTI string: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html diff --git a/doc/render-context/plist.md b/doc/render-context/plist.md index 7dc8fcf..1fbc5ce 100644 --- a/doc/render-context/plist.md +++ b/doc/render-context/plist.md @@ -61,6 +61,8 @@ The `--plist-template` and `--strings-template` arguments point to template file ``` +Note that `CFBundleLocalizations` declares the localizations handled by the application itself rather than those discovered through the bundle localization mechanism — think of a Qt application localizing through its embedded translations. MetaGlot only knows the metadata languages (the languages receiving an `InfoPlist.strings` file), so rendering `langs` into this key assumes the application's self-handled UI languages and its metadata languages are the same set — the common case when the project translates both in lockstep. When the two differ, maintain the list in the template yourself instead of iterating `langs`. An application localizing entirely through the bundle mechanism usually does not need this key at all. + The source language always leads `langs` and always gets an InfoPlist.strings file: it comes from a PO file when one provides it, and is otherwise synthesized from the manifest's source strings. Every language listed in `langs` is guaranteed a complete `.lproj` folder. ### `--strings-template` diff --git a/example/Info.plist.liquid b/example/Info.plist.liquid index 053d5a9..c0c6acd 100644 --- a/example/Info.plist.liquid +++ b/example/Info.plist.liquid @@ -26,6 +26,13 @@ NSHumanReadableCopyright {{ default.strings.copyright | xml_escape }} +{% comment %} +CFBundleLocalizations declares the localizations the application handles by itself, +not those discovered through the bundle localization mechanism. +This example assumes the application's UI languages (e.g. Qt-embedded translations) match its metadata languages, +so it renders the metadata language list directly; +maintain your own list here if the two ever differ. +{% endcomment %} CFBundleLocalizations {% for lang in langs %}