refactor: use metaglot to take macos bundle i18n over
- use metaglot for macos bundle i18n - set macos icon from PUBLIC to PRIVATE - remove CFBundleLongVersionString from Info.plist
This commit is contained in:
+33
-4
@@ -229,19 +229,48 @@ if (WIN32)
|
|||||||
WIN32_EXECUTABLE TRUE
|
WIN32_EXECUTABLE TRUE
|
||||||
)
|
)
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
|
# Include icon to project
|
||||||
set_source_files_properties(dist/sarasacw-picture.icns PROPERTIES
|
set_source_files_properties(dist/sarasacw-picture.icns PROPERTIES
|
||||||
MACOSX_PACKAGE_LOCATION "Resources"
|
MACOSX_PACKAGE_LOCATION "Resources"
|
||||||
)
|
)
|
||||||
target_sources(${EXE_NAME} PUBLIC dist/sarasacw-picture.icns)
|
target_sources(${EXE_NAME} PRIVATE dist/sarasacw-picture.icns)
|
||||||
|
|
||||||
|
# Setup Info.plist related directory.
|
||||||
|
set (PPIC_PLIST_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/plist-metadata)
|
||||||
|
# Render Info.plist and its strings.
|
||||||
|
execute_process (
|
||||||
|
COMMAND ${UV_EXECUTABLE} tool run metaglot render plist
|
||||||
|
--manifest ${CMAKE_SOURCE_DIR}/dist/Info.plist.in.toml
|
||||||
|
--po ${CMAKE_SOURCE_DIR}/locales/plist/*.po
|
||||||
|
--plist-template ${CMAKE_SOURCE_DIR}/dist/Info.plist.in.liquid
|
||||||
|
--strings-template ${CMAKE_SOURCE_DIR}/dist/InfoPlist.strings.liquid
|
||||||
|
--plist-path Info.plist.in
|
||||||
|
--strings-path "Resources/{{ lang }}.lproj/InfoPlist.strings"
|
||||||
|
--output ${PPIC_PLIST_OUTPUT_DIR}
|
||||||
|
RESULT_VARIABLE METAGLOT_PLIST_RESULT
|
||||||
|
)
|
||||||
|
if (NOT METAGLOT_PLIST_RESULT EQUAL 0)
|
||||||
|
message (FATAL_ERROR "Failed to render Info.plist metadata via MetaGlot (exit code: ${METAGLOT_PLIST_RESULT}).")
|
||||||
|
endif ()
|
||||||
|
# Include these to project.
|
||||||
|
file (GLOB PPIC_PLIST_STRINGS_FILES ${PPIC_PLIST_OUTPUT_DIR}/Resources/*.lproj/InfoPlist.strings)
|
||||||
|
foreach (plist_strings_file ${PPIC_PLIST_STRINGS_FILES})
|
||||||
|
get_filename_component (plist_lproj_dir ${plist_strings_file} DIRECTORY)
|
||||||
|
get_filename_component (plist_lproj_name ${plist_lproj_dir} NAME)
|
||||||
|
set_source_files_properties (${plist_strings_file} PROPERTIES
|
||||||
|
MACOSX_PACKAGE_LOCATION "Resources/${plist_lproj_name}"
|
||||||
|
)
|
||||||
|
target_sources (${EXE_NAME} PRIVATE ${plist_strings_file})
|
||||||
|
endforeach ()
|
||||||
# See https://cmake.org/cmake/help/v3.15/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.html
|
# See https://cmake.org/cmake/help/v3.15/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.html
|
||||||
set_target_properties(${EXE_NAME} PROPERTIES
|
set_target_properties(${EXE_NAME} PROPERTIES
|
||||||
MACOSX_BUNDLE TRUE
|
MACOSX_BUNDLE TRUE
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/dist/MacOSXBundleInfo.plist.in
|
MACOSX_BUNDLE_INFO_PLIST ${PPIC_PLIST_OUTPUT_DIR}/Info.plist.in
|
||||||
MACOSX_BUNDLE_BUNDLE_NAME "Pineapple Pictures"
|
MACOSX_BUNDLE_INFO_STRING "${PROJECT_VERSION}, Copyright (C) 2026 Gary Wang"
|
||||||
MACOSX_BUNDLE_GUI_IDENTIFIER net.blumia.pineapple-pictures
|
MACOSX_BUNDLE_GUI_IDENTIFIER net.blumia.pineapple-pictures
|
||||||
MACOSX_BUNDLE_ICON_FILE sarasacw-picture.icns # contains the .icns file name, *without* the path.
|
MACOSX_BUNDLE_ICON_FILE sarasacw-picture.icns # contains the .icns file name, *without* the path.
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
||||||
)
|
)
|
||||||
elseif (UNIX)
|
elseif (UNIX)
|
||||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
|
|||||||
+16
-23
@@ -14,10 +14,8 @@
|
|||||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleLongVersionString</key>
|
|
||||||
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
<string>{{ default.strings.app_name | xml_escape }}</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
@@ -29,28 +27,23 @@
|
|||||||
<key>CSResourcesFileMapped</key>
|
<key>CSResourcesFileMapped</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
<string>MIT/Expat License - Copyright (C) 2026 Gary Wang</string>
|
||||||
<!-- FIXME: this list can't be automatically generated by Qt's CMake API, don't know why. -->
|
<!--
|
||||||
|
CFBundleLocalizations is generated from the metadata localization languages (the metaglot
|
||||||
|
"langs" list), while this field by definition describes the application's language
|
||||||
|
availability. This deviation works around an upstream Qt bug: since the Qt 6.7.0 refactor,
|
||||||
|
the CMake function _qt_internal_store_languages_from_ts_files_in_targets loses the parsed
|
||||||
|
TS language codes (a missing list(APPEND)), so Qt's own CFBundleLocalizations generation
|
||||||
|
yields an empty list. Consistency between the metadata languages and the application
|
||||||
|
languages is maintained manually at release time.
|
||||||
|
TODO: drop this workaround and let Qt generate CFBundleLocalizations itself once the
|
||||||
|
upstream bug is fixed and the fix ships in the CI toolchain.
|
||||||
|
-->
|
||||||
<key>CFBundleLocalizations</key>
|
<key>CFBundleLocalizations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>en</string>
|
{% for lang in langs %}
|
||||||
<string>ca</string>
|
<string>{{ lang }}</string>
|
||||||
<string>de</string>
|
{% endfor %}
|
||||||
<string>es</string>
|
|
||||||
<string>fr</string>
|
|
||||||
<string>id</string>
|
|
||||||
<string>it</string>
|
|
||||||
<string>ja</string>
|
|
||||||
<string>ko</string>
|
|
||||||
<string>nb_NO</string>
|
|
||||||
<string>nl</string>
|
|
||||||
<string>pa_PK</string>
|
|
||||||
<string>ru</string>
|
|
||||||
<string>si</string>
|
|
||||||
<string>ta</string>
|
|
||||||
<string>tr</string>
|
|
||||||
<string>uk</string>
|
|
||||||
<string>zh_CN</string>
|
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleDocumentTypes</key>
|
<key>CFBundleDocumentTypes</key>
|
||||||
<array>
|
<array>
|
||||||
Vendored
+26
@@ -0,0 +1,26 @@
|
|||||||
|
version = 1
|
||||||
|
source_language = "en"
|
||||||
|
|
||||||
|
[strings.app_name]
|
||||||
|
msgid = "Pineapple Pictures"
|
||||||
|
comment = "Display name of the application."
|
||||||
|
|
||||||
|
[strings.file_type_jpeg]
|
||||||
|
msgid = "JPEG Image"
|
||||||
|
comment = "Name of the JPEG document type (jpg, jpeg, jfif)."
|
||||||
|
|
||||||
|
[strings.file_type_png]
|
||||||
|
msgid = "PNG Image"
|
||||||
|
comment = "Name of the PNG document type."
|
||||||
|
|
||||||
|
[strings.file_type_webp]
|
||||||
|
msgid = "WebP Image"
|
||||||
|
comment = "Name of the WebP document type."
|
||||||
|
|
||||||
|
[strings.file_type_gif]
|
||||||
|
msgid = "GIF Image"
|
||||||
|
comment = "Name of the GIF document type."
|
||||||
|
|
||||||
|
[strings.file_type_svg]
|
||||||
|
msgid = "SVG Image"
|
||||||
|
comment = "Name of the SVG document type."
|
||||||
Vendored
+8
@@ -0,0 +1,8 @@
|
|||||||
|
/* Application display name. The key is the Info.plist key name. */
|
||||||
|
"CFBundleName" = "{{ strings.app_name | plist_strings_escape }}";
|
||||||
|
/* File type names. The key is the source text, covering CFBundleTypeName. */
|
||||||
|
"{{ sources.file_type_jpeg | plist_strings_escape }}" = "{{ strings.file_type_jpeg | plist_strings_escape }}";
|
||||||
|
"{{ sources.file_type_png | plist_strings_escape }}" = "{{ strings.file_type_png | plist_strings_escape }}";
|
||||||
|
"{{ sources.file_type_webp | plist_strings_escape }}" = "{{ strings.file_type_webp | plist_strings_escape }}";
|
||||||
|
"{{ sources.file_type_gif | plist_strings_escape }}" = "{{ strings.file_type_gif | plist_strings_escape }}";
|
||||||
|
"{{ sources.file_type_svg | plist_strings_escape }}" = "{{ strings.file_type_svg | plist_strings_escape }}";
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: MetaGlot/polib\n"
|
||||||
|
|
||||||
|
#. Display name of the application.
|
||||||
|
msgid "Pineapple Pictures"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Name of the JPEG document type (jpg, jpeg, jfif).
|
||||||
|
msgid "JPEG Image"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Name of the PNG document type.
|
||||||
|
msgid "PNG Image"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Name of the WebP document type.
|
||||||
|
msgid "WebP Image"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Name of the GIF document type.
|
||||||
|
msgid "GIF Image"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Name of the SVG document type.
|
||||||
|
msgid "SVG Image"
|
||||||
|
msgstr ""
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: pineapple-pictures\n"
|
||||||
|
"Language: zh_CN\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||||
|
|
||||||
|
#. Display name of the application.
|
||||||
|
msgid "Pineapple Pictures"
|
||||||
|
msgstr "菠萝看图"
|
||||||
|
|
||||||
|
#. Name of the JPEG document type (jpg, jpeg, jfif).
|
||||||
|
msgid "JPEG Image"
|
||||||
|
msgstr "JPEG 图像"
|
||||||
|
|
||||||
|
#. Name of the PNG document type.
|
||||||
|
msgid "PNG Image"
|
||||||
|
msgstr "PNG 图像"
|
||||||
|
|
||||||
|
#. Name of the WebP document type.
|
||||||
|
msgid "WebP Image"
|
||||||
|
msgstr "WebP 图像"
|
||||||
|
|
||||||
|
#. Name of the GIF document type.
|
||||||
|
msgid "GIF Image"
|
||||||
|
msgstr "GIF 图像"
|
||||||
|
|
||||||
|
#. Name of the SVG document type.
|
||||||
|
msgid "SVG Image"
|
||||||
|
msgstr "SVG 图像"
|
||||||
Reference in New Issue
Block a user