From 460b0273772f313ff533ba655ccaa11cf7acef5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 3 May 2020 02:39:22 +0200 Subject: Add the ability to translate: + Catalog for strings in the plugin. + Desktop file translations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- CMakeL10n.txt | 23 ++++++++ CMakeLists.txt | 5 +- src/CMakeL10n.txt | 10 ++++ src/CMakeLists.txt | 6 +- src/thememoodin.cpp | 1 + src/themes/Architecture/CMakeLists.txt | 11 +++- src/themes/CMakeL10n.txt | 9 +++ src/themes/FingerPrint/CMakeLists.txt | 11 +++- src/themes/MoodinKDE/CMakeLists.txt | 11 +++- translations/CMakeLists.txt | 1 + .../ksplashmoodin.desktop.pot | 27 +++++++++ translations/desktop_files/themes/themes.pot | 69 ++++++++++++++++++++++ translations/messages/CMakeLists.txt | 14 +++++ translations/messages/ksplash-engine-moodin.pot | 30 ++++++++++ 14 files changed, 219 insertions(+), 9 deletions(-) create mode 100644 CMakeL10n.txt create mode 100644 src/CMakeL10n.txt create mode 100644 src/themes/CMakeL10n.txt create mode 100644 translations/CMakeLists.txt create mode 100644 translations/desktop_files/ksplashmoodin.desktop/ksplashmoodin.desktop.pot create mode 100644 translations/desktop_files/themes/themes.pot create mode 100644 translations/messages/CMakeLists.txt create mode 100644 translations/messages/ksplash-engine-moodin.pot diff --git a/CMakeL10n.txt b/CMakeL10n.txt new file mode 100644 index 0000000..e4b7476 --- /dev/null +++ b/CMakeL10n.txt @@ -0,0 +1,23 @@ +################################################# +# +# (C) 2020 Slávek Banko +# slavek.banko (AT) axis.cz +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +cmake_minimum_required( VERSION 2.8 ) + + +##### include our cmake modules ################# + +set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) +include( TDEL10n ) + + +##### create translation templates ############## + +tde_l10n_auto_add_subdirectories( ) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1e4eba..0b9fae7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,9 @@ option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ##### user requested modules -option( BUILD_ALL "Build all" ON ) +option( BUILD_ALL "Build all" ON ) +option( BUILD_THEMES "Build themes" ${BUILD_ALL} ) +option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} ) ##### configure checks @@ -67,6 +69,7 @@ set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" ##### directories add_subdirectory( src ) +tde_conditional_add_subdirectory( BUILD_TRANSLATIONS translations ) ##### write configure files diff --git a/src/CMakeL10n.txt b/src/CMakeL10n.txt new file mode 100644 index 0000000..cdeb121 --- /dev/null +++ b/src/CMakeL10n.txt @@ -0,0 +1,10 @@ +##### create translation templates ############## + +tde_l10n_create_template( "messages/ksplash-engine-moodin" ) + +tde_l10n_create_template( + CATALOG "desktop_files/ksplashmoodin.desktop/" + SOURCES ksplashmoodin.desktop +) + +tde_l10n_auto_add_subdirectories( ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7ad6a22..e635036 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -add_subdirectory( themes ) +tde_conditional_add_subdirectory( BUILD_THEMES themes ) include_directories( ${CMAKE_BINARY_DIR} @@ -36,7 +36,7 @@ tde_add_kpart( ksplashmoodin AUTOMOC ##### other data -install( - FILES ksplashmoodin.desktop +tde_create_translated_desktop( + SOURCE ksplashmoodin.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/src/thememoodin.cpp b/src/thememoodin.cpp index b87b92a..d7fb17f 100644 --- a/src/thememoodin.cpp +++ b/src/thememoodin.cpp @@ -37,6 +37,7 @@ K_EXPORT_COMPONENT_FACTORY(ksplashmoodin, KGenericFactory("ksplash" ThemeMoodin::ThemeMoodin(TQWidget* parent, const char* name, const TQStringList& args) :ThemeEngine(parent, name, args) { + TDEGlobal::locale()->insertCatalogue( "ksplash-engine-moodin" ); readSettings(); init(); } diff --git a/src/themes/Architecture/CMakeLists.txt b/src/themes/Architecture/CMakeLists.txt index 90bc1fb..5af4a21 100644 --- a/src/themes/Architecture/CMakeLists.txt +++ b/src/themes/Architecture/CMakeLists.txt @@ -1,6 +1,13 @@ -file( GLOB _pics RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.png ) +file( GLOB _pics RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.png *.jpg ) install( - FILES ${_pics} Background.jpg Theme.rc + FILES ${_pics} DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/Architecture ) + +tde_create_translated_desktop( + SOURCE Theme.rc + KEYWORDS Label1 Label2 Label3 Label4 Label5 + DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/Architecture + PO_DIR ${CMAKE_SOURCE_DIR}/translations/desktop_files/themes +) diff --git a/src/themes/CMakeL10n.txt b/src/themes/CMakeL10n.txt new file mode 100644 index 0000000..66cd231 --- /dev/null +++ b/src/themes/CMakeL10n.txt @@ -0,0 +1,9 @@ +##### create translation templates ############## + +file( GLOB_RECURSE _themes RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Theme.rc ) + +tde_l10n_create_template( + CATALOG "desktop_files/themes/" + SOURCES_DESKTOP ${_themes} + KEYWORDS Label1 Label2 Label3 Label4 Label5 +) diff --git a/src/themes/FingerPrint/CMakeLists.txt b/src/themes/FingerPrint/CMakeLists.txt index cfcad13..fa5afec 100644 --- a/src/themes/FingerPrint/CMakeLists.txt +++ b/src/themes/FingerPrint/CMakeLists.txt @@ -1,6 +1,13 @@ -file( GLOB _pics RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.png ) +file( GLOB _pics RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.png *.jpg ) install( - FILES ${_pics} Background.jpg Theme.rc + FILES ${_pics} DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/FingerPrint ) + +tde_create_translated_desktop( + SOURCE Theme.rc + KEYWORDS Label1 Label2 Label3 Label4 Label5 + DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/FingerPrint + PO_DIR ${CMAKE_SOURCE_DIR}/translations/desktop_files/themes +) diff --git a/src/themes/MoodinKDE/CMakeLists.txt b/src/themes/MoodinKDE/CMakeLists.txt index d0fbb88..68afed2 100644 --- a/src/themes/MoodinKDE/CMakeLists.txt +++ b/src/themes/MoodinKDE/CMakeLists.txt @@ -1,4 +1,13 @@ +file( GLOB _pics RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.png *.jpg ) + install( - FILES Background.jpg Preview.png Theme.rc + FILES ${_pics} DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/MoodinKDE ) + +tde_create_translated_desktop( + SOURCE Theme.rc + KEYWORDS Label1 Label2 Label3 Label4 Label5 + DESTINATION ${DATA_INSTALL_DIR}/ksplash/Themes/MoodinKDE + PO_DIR ${CMAKE_SOURCE_DIR}/translations/desktop_files/themes +) diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt new file mode 100644 index 0000000..42b186a --- /dev/null +++ b/translations/CMakeLists.txt @@ -0,0 +1 @@ +tde_auto_add_subdirectories() diff --git a/translations/desktop_files/ksplashmoodin.desktop/ksplashmoodin.desktop.pot b/translations/desktop_files/ksplashmoodin.desktop/ksplashmoodin.desktop.pot new file mode 100644 index 0000000..5c6c3e0 --- /dev/null +++ b/translations/desktop_files/ksplashmoodin.desktop/ksplashmoodin.desktop.pot @@ -0,0 +1,27 @@ +# SOME DESCRIPTIVE TITLE. +# This file is put in the public domain. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-03 01:02+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Comment +#: ksplashmoodin.desktop:2 +msgid "KSplash Plugin" +msgstr "" + +#. Name +#: ksplashmoodin.desktop:5 +msgid "KSplashMoodin" +msgstr "" diff --git a/translations/desktop_files/themes/themes.pot b/translations/desktop_files/themes/themes.pot new file mode 100644 index 0000000..66fe3d6 --- /dev/null +++ b/translations/desktop_files/themes/themes.pot @@ -0,0 +1,69 @@ +# SOME DESCRIPTIVE TITLE. +# This file is put in the public domain. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-03 00:58+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Name +#: Architecture/Theme.rc:2 +msgid "Architecture" +msgstr "" + +#. Description +#: Architecture/Theme.rc:3 +msgid "Fading splash screen based on the Moodin engine, for widescreens" +msgstr "" + +#. Label1 +#: Architecture/Theme.rc:43 +msgid "Welcome to TDE" +msgstr "" + +#. Name +#: FingerPrint/Theme.rc:2 +msgid "FingerPrint" +msgstr "" + +#. Description +#: FingerPrint/Theme.rc:3 +msgid "" +"Taste your fingers (wallpaper from Dalmases http://www.deviantart.com/" +"deviation/11180503/)" +msgstr "" + +#. Label1 +#: FingerPrint/Theme.rc:33 +msgid "Validating..." +msgstr "" + +#. Label2 +#: FingerPrint/Theme.rc:37 +msgid "ML:USER:loginname" +msgstr "" + +#. Name +#: MoodinKDE/Theme.rc:2 +msgid "MoodinKDE" +msgstr "" + +#. Description +#: MoodinKDE/Theme.rc:3 +msgid "Fading splash screen based on the svg wallpaper (Lineart Logo)" +msgstr "" + +#. Label1 +#: MoodinKDE/Theme.rc:24 +msgid "Welcome" +msgstr "" diff --git a/translations/messages/CMakeLists.txt b/translations/messages/CMakeLists.txt new file mode 100644 index 0000000..75c89f8 --- /dev/null +++ b/translations/messages/CMakeLists.txt @@ -0,0 +1,14 @@ +file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po ) +string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" ) + +foreach( _po ${po_files} ) + get_filename_component( _lang ${_po} NAME_WE ) + if( "${_linguas}" MATCHES "^;*$" OR ";${_linguas};" MATCHES ";${_lang};" ) + if( "${_po}" MATCHES "^([^/]*)/.*" ) + string( REGEX REPLACE "^([^/]*)/.*" "\\1" _component "${_po}" ) + else( ) + set( _component "${PROJECT_NAME}" ) + endif( ) + tde_create_translation( FILES ${_po} LANG ${_lang} OUTPUT_NAME ${_component} ) + endif( ) +endforeach( ) diff --git a/translations/messages/ksplash-engine-moodin.pot b/translations/messages/ksplash-engine-moodin.pot new file mode 100644 index 0000000..d4dc937 --- /dev/null +++ b/translations/messages/ksplash-engine-moodin.pot @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2020-05-03 00:39+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: _translatorinfo:1 +msgid "" +"_: NAME OF TRANSLATORS\n" +"Your names" +msgstr "" + +#: _translatorinfo:2 +msgid "" +"_: EMAIL OF TRANSLATORS\n" +"Your emails" +msgstr "" + +#: thememoodin.cpp:202 +msgid "No background. Try to put a Background.jpg in theme folder" +msgstr "" -- cgit v1.2.1