Added CMake configuration for compiling localization message catalog files

Also added initial message catalog files
This commit is contained in:
Leon Styhre 2024-06-30 13:44:48 +02:00
parent ec8a49623a
commit fec433d4b2
5 changed files with 81 additions and 1 deletions

View file

@ -35,6 +35,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils
option(GL "Set to ON if targeting Desktop OpenGL" ON) option(GL "Set to ON if targeting Desktop OpenGL" ON)
option(GLES "Set to ON if targeting OpenGL ES" OFF) option(GLES "Set to ON if targeting OpenGL ES" OFF)
option(APPLICATION_UPDATER "Set to OFF to build without the application updater" ON) option(APPLICATION_UPDATER "Set to OFF to build without the application updater" ON)
option(COMPILE_LOCALIZATIONS "Set to OFF to skip compilation of localization message catalogs" ON)
option(APPIMAGE_BUILD "Set to ON when building as an AppImage" OFF) option(APPIMAGE_BUILD "Set to ON when building as an AppImage" OFF)
option(AUR_BUILD "Set to ON when building for the AUR" OFF) option(AUR_BUILD "Set to ON when building for the AUR" OFF)
option(FLATPAK_BUILD "Set to ON when building as a Flatpak" OFF) option(FLATPAK_BUILD "Set to ON when building as a Flatpak" OFF)
@ -679,7 +680,10 @@ set(dir ${CMAKE_CURRENT_SOURCE_DIR})
set(EXECUTABLE_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE) set(EXECUTABLE_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE) set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
# Add each component. if (COMPILE_LOCALIZATIONS)
add_subdirectory(locale)
endif()
add_subdirectory(es-pdf-converter) add_subdirectory(es-pdf-converter)
add_subdirectory(external) add_subdirectory(external)
add_subdirectory(es-core) add_subdirectory(es-core)
@ -689,5 +693,9 @@ add_subdirectory(es-app)
# Also set lottie2gif to not be built. # Also set lottie2gif to not be built.
add_dependencies(lunasvg es-pdf-convert) add_dependencies(lunasvg es-pdf-convert)
if (COMPILE_LOCALIZATIONS)
add_dependencies(es-pdf-convert locale)
endif()
add_dependencies(es-core rlottie) add_dependencies(es-core rlottie)
set_target_properties(lottie2gif PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) set_target_properties(lottie2gif PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)

27
locale/CMakeLists.txt Normal file
View file

@ -0,0 +1,27 @@
# SPDX-License-Identifier: MIT
#
# ES-DE Frontend
# CMakeLists.txt (locale)
#
# CMake configuration for compiling localization message catalog files using msgfmt
#
add_custom_target(locale ALL COMMENT "Compiling localization message catalogs")
find_program(MSGFMT_BINARY msgfmt)
if(NOT MSGFMT_BINARY)
message (FATAL_ERROR "Couldn't find msgfmt binary")
endif()
file(GLOB PO_FILES ${PROJECT_SOURCE_DIR}/locale/po/*.po)
foreach (PO_FILE ${PO_FILES})
get_filename_component(PO_FILENAME ${PO_FILE} NAME)
get_filename_component(PO_BASENAME ${PO_FILENAME} NAME_WE)
add_custom_command(TARGET locale COMMAND echo "Compiling message catalog for locale" ${PO_BASENAME})
add_custom_command(TARGET locale COMMAND mkdir -p ${PROJECT_SOURCE_DIR}/resources/locale/${PO_BASENAME}/LC_MESSAGES)
add_custom_command(TARGET locale COMMAND ${MSGFMT_BINARY} -c --statistics -o ${PROJECT_SOURCE_DIR}/resources/locale/${PO_BASENAME}/LC_MESSAGES/${PO_BASENAME}.mo ${PO_FILE})
endforeach()
add_custom_command(TARGET locale COMMAND echo)

22
locale/es-de.pot Normal file
View file

@ -0,0 +1,22 @@
# ES-DE Frontend translation strings.
# Copyright (c) 2024-present Northwestern Software AB
# This file is distributed under the same license as the ES-DE Frontend package.
# Northwestern Software <info@es-de.org>, 2024.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ES-DE Frontend\n"
"Report-Msgid-Bugs-To: info@es-de.org\n"
"POT-Creation-Date: 2024-06-30 13:38+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <info@es-de.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../es-app/src/guis/GuiMenu.cpp:52
msgid "MAIN MENU"
msgstr ""

1
locale/languages Normal file
View file

@ -0,0 +1 @@
sv_SE

22
locale/po/sv_SE.po Normal file
View file

@ -0,0 +1,22 @@
# ES-DE Frontend translation strings.
# Copyright (c) 2024-present Northwestern Software AB
# This file is distributed under the same license as the ES-DE Frontend package.
# Northwestern Software <info@es-de.org>, 2024.
#
msgid ""
msgstr ""
"Project-Id-Version: ES-DE Frontend\n"
"Report-Msgid-Bugs-To: info@es-de.org\n"
"POT-Creation-Date: 2024-06-30 13:38+0200\n"
"PO-Revision-Date: 2024-06-29 14:03+0200\n"
"Last-Translator: Northwestern Software <info@es-de.org>\n"
"Language-Team: Swedish <info@es-de.org>\n"
"Language: sv_SE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../es-app/src/guis/GuiMenu.cpp:52
msgid "MAIN MENU"
msgstr "HUVUDMENY"