From e79fc265f939f1cea76f3d7c924308635fccdb51 Mon Sep 17 00:00:00 2001
From: Slávek Banko <slavek.banko@axis.cz>
Date: Wed, 6 May 2020 13:49:08 +0200
Subject: Move translations to a new directory layout. Add support for LINGUAS
 for listing translations to install.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
---
 CMakeLists.txt                       |   4 +-
 doc/CMakeLists.txt                   |  15 +++-
 tdesudo/CMakeL10n.txt                |   2 +-
 translations/CMakeLists.txt          |   1 +
 translations/messages/CMakeLists.txt |  14 ++++
 translations/messages/de.po          | 137 ++++++++++++++++++++++++++++++++
 translations/messages/fr.po          | 146 +++++++++++++++++++++++++++++++++++
 translations/messages/tdesudo.pot    | 137 ++++++++++++++++++++++++++++++++
 8 files changed, 452 insertions(+), 4 deletions(-)
 create mode 100644 translations/CMakeLists.txt
 create mode 100644 translations/messages/CMakeLists.txt
 create mode 100644 translations/messages/de.po
 create mode 100644 translations/messages/fr.po
 create mode 100644 translations/messages/tdesudo.pot

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1176115..73e4a6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,8 +69,8 @@ set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined"
 ##### directories
 
 add_subdirectory( ${PROJECT_NAME} )
-tde_conditional_add_subdirectory( BUILD_DOC doc         )
-tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po ) 
+tde_conditional_add_subdirectory( BUILD_DOC doc )
+tde_conditional_add_subdirectory( BUILD_TRANSLATIONS translations )
 
 
 ##### write configure files
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 6d0aa9f..70d6348 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1 +1,14 @@
-tde_auto_add_subdirectories( )
+file( GLOB _dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} * )
+string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" )
+
+foreach( _dir ${_dirs} )
+  if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} AND
+      EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeLists.txt )
+    if( "${_dir}" STREQUAL "en" OR
+        "${_dir}" STREQUAL "man" OR
+        "${_linguas}" MATCHES "^;*$" OR
+        ";${_linguas};" MATCHES ";${_dir};" )
+      add_subdirectory( ${_dir} )
+    endif( )
+  endif()
+endforeach()
diff --git a/tdesudo/CMakeL10n.txt b/tdesudo/CMakeL10n.txt
index 2db4698..1d9d9c4 100644
--- a/tdesudo/CMakeL10n.txt
+++ b/tdesudo/CMakeL10n.txt
@@ -1,3 +1,3 @@
 ##### create translation templates ##############
 
-tde_l10n_create_template( "tdesudo" )
+tde_l10n_create_template( "messages/tdesudo" )
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/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/de.po b/translations/messages/de.po
new file mode 100644
index 0000000..dfc8758
--- /dev/null
+++ b/translations/messages/de.po
@@ -0,0 +1,137 @@
+# SOME DESCRIPTIVE TITLE.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2018-12-11 16:55+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: de\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 ""
+
+#: main.cpp:41 main.cpp:66
+msgid "TdeSudo"
+msgstr ""
+
+#: main.cpp:47
+msgid "sets a runas user"
+msgstr ""
+
+#: main.cpp:48 main.cpp:60
+msgid "The command to execute"
+msgstr ""
+
+#: main.cpp:49
+msgid "Forget passwords"
+msgstr ""
+
+#: main.cpp:50
+msgid "Specify icon to use in the password dialog"
+msgstr ""
+
+#: main.cpp:51
+msgid "Do not show the command to be run in the dialog"
+msgstr ""
+
+#: main.cpp:52
+msgid "Process priority, between 0 and 100, 0 the lowest [50]"
+msgstr ""
+
+#: main.cpp:53
+msgid "Use realtime scheduling"
+msgstr ""
+
+#: main.cpp:54
+msgid "Use target UID if <file> is not writeable"
+msgstr ""
+
+#: main.cpp:55
+msgid "Fake option for TDE's TdeSu compatibility"
+msgstr ""
+
+#: main.cpp:56
+msgid "Do not keep password"
+msgstr ""
+
+#: main.cpp:57
+msgid "Use existing DCOP server"
+msgstr ""
+
+#: main.cpp:58
+msgid "The comment that should be displayed in the dialog"
+msgstr ""
+
+#: main.cpp:59
+msgid "Do not display « ignore » button"
+msgstr ""
+
+#: main.cpp:99
+msgid ""
+"You must provide the name of the executable you want to run as an argument "
+"to tdesudo"
+msgstr ""
+
+#: tdesudo.cpp:52
+msgid ""
+"<b>%1</b> needs administrative privileges. Please enter your password for "
+"verification."
+msgstr ""
+
+#: tdesudo.cpp:75
+msgid ""
+"No command arguments supplied!\n"
+"Usage: tdesudo [-u <runas>] <command>\n"
+"TdeSudo will now exit..."
+msgstr ""
+
+#: tdesudo.cpp:122
+msgid "&Ignore"
+msgstr ""
+
+#: tdesudo.cpp:249 tdesudo.cpp:261
+msgid "Priority:"
+msgstr ""
+
+#: tdesudo.cpp:249
+msgid "realtime:"
+msgstr ""
+
+#: tdesudo.cpp:307
+msgid "Command:"
+msgstr ""
+
+#: tdesudo.cpp:347
+msgid "Wrong password! Exiting..."
+msgstr ""
+
+#: tdesudo.cpp:354
+msgid "Command not found!"
+msgstr ""
+
+#: tdesudo.cpp:360
+msgid "Your username is unknown to sudo!"
+msgstr ""
+
+#: tdesudo.cpp:366
+msgid "Your user is not allowed to run the specified command!"
+msgstr ""
+
+#: tdesudo.cpp:372 tdesudo.cpp:378
+msgid "Your user is not allowed to run sudo on this host!"
+msgstr ""
diff --git a/translations/messages/fr.po b/translations/messages/fr.po
new file mode 100644
index 0000000..480f576
--- /dev/null
+++ b/translations/messages/fr.po
@@ -0,0 +1,146 @@
+# translation of fr.po to
+# This file is put in the public domain.
+#
+# Anthony Mercatante <tonio@ubuntu.com>, 2007.
+msgid ""
+msgstr ""
+"Project-Id-Version: fr\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-12-11 16:55+0100\n"
+"PO-Revision-Date: 2007-06-01 16:18+0200\n"
+"Last-Translator: Anthony Mercatante <tonio@ubuntu.com>\n"
+"Language-Team:  <fr@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
+
+#: _translatorinfo:1
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr "Anthony Mercatante"
+
+#: _translatorinfo:2
+msgid ""
+"_: EMAIL OF TRANSLATORS\n"
+"Your emails"
+msgstr "tonio@ubuntu.com"
+
+#: main.cpp:41 main.cpp:66
+msgid "TdeSudo"
+msgstr "TdeSudo"
+
+#: main.cpp:47
+msgid "sets a runas user"
+msgstr "Spécifie l'utilisateur cible"
+
+#: main.cpp:48 main.cpp:60
+msgid "The command to execute"
+msgstr "Commande à exécuter"
+
+#: main.cpp:49
+msgid "Forget passwords"
+msgstr ""
+
+#: main.cpp:50
+msgid "Specify icon to use in the password dialog"
+msgstr ""
+
+#: main.cpp:51
+msgid "Do not show the command to be run in the dialog"
+msgstr ""
+
+#: main.cpp:52
+msgid "Process priority, between 0 and 100, 0 the lowest [50]"
+msgstr ""
+
+#: main.cpp:53
+msgid "Use realtime scheduling"
+msgstr ""
+
+#: main.cpp:54
+msgid "Use target UID if <file> is not writeable"
+msgstr ""
+
+#: main.cpp:55
+msgid "Fake option for TDE's TdeSu compatibility"
+msgstr ""
+
+#: main.cpp:56
+msgid "Do not keep password"
+msgstr ""
+
+#: main.cpp:57
+msgid "Use existing DCOP server"
+msgstr ""
+
+#: main.cpp:58
+msgid "The comment that should be displayed in the dialog"
+msgstr "Commentaire à afficher dans la boite de dialogue"
+
+#: main.cpp:59
+msgid "Do not display « ignore » button"
+msgstr ""
+
+#: main.cpp:99
+msgid ""
+"You must provide the name of the executable you want to run as an argument "
+"to tdesudo"
+msgstr ""
+
+#: tdesudo.cpp:52
+msgid ""
+"<b>%1</b> needs administrative privileges. Please enter your password for "
+"verification."
+msgstr ""
+"<b>%1</b> a besoin des droits d'administration. Merci de saisir votre mot de "
+"passe pour vérification."
+
+#: tdesudo.cpp:75
+msgid ""
+"No command arguments supplied!\n"
+"Usage: tdesudo [-u <runas>] <command>\n"
+"TdeSudo will now exit..."
+msgstr ""
+"Aucune commande spécifiée en argument!\n"
+"Utilisation: tdesudo [-u <runas>] <command>\n"
+"TdeSudo va maintenant se fermer..."
+
+#: tdesudo.cpp:122
+msgid "&Ignore"
+msgstr ""
+
+#: tdesudo.cpp:249 tdesudo.cpp:261
+msgid "Priority:"
+msgstr ""
+
+#: tdesudo.cpp:249
+msgid "realtime:"
+msgstr ""
+
+#: tdesudo.cpp:307
+msgid "Command:"
+msgstr ""
+
+#: tdesudo.cpp:347
+#, fuzzy
+msgid "Wrong password! Exiting..."
+msgstr "Mot de passe erroné, veuillez réessayer!"
+
+#: tdesudo.cpp:354
+msgid "Command not found!"
+msgstr "Commande inexistante!"
+
+#: tdesudo.cpp:360
+msgid "Your username is unknown to sudo!"
+msgstr "Votre nom d'utilisateur est inconnu de sudo!"
+
+#: tdesudo.cpp:366
+msgid "Your user is not allowed to run the specified command!"
+msgstr "Vous n'avez pas le droit d'exécuter la commande spécifiée!"
+
+#: tdesudo.cpp:372 tdesudo.cpp:378
+msgid "Your user is not allowed to run sudo on this host!"
+msgstr "Vous n'avez pas le droit d'exécuter sudo sud l'hôte spécifié!"
diff --git a/translations/messages/tdesudo.pot b/translations/messages/tdesudo.pot
new file mode 100644
index 0000000..2ba8196
--- /dev/null
+++ b/translations/messages/tdesudo.pot
@@ -0,0 +1,137 @@
+# SOME DESCRIPTIVE TITLE.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2018-12-11 16:55+0100\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"
+
+#: _translatorinfo:1
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr ""
+
+#: _translatorinfo:2
+msgid ""
+"_: EMAIL OF TRANSLATORS\n"
+"Your emails"
+msgstr ""
+
+#: main.cpp:41 main.cpp:66
+msgid "TdeSudo"
+msgstr ""
+
+#: main.cpp:47
+msgid "sets a runas user"
+msgstr ""
+
+#: main.cpp:48 main.cpp:60
+msgid "The command to execute"
+msgstr ""
+
+#: main.cpp:49
+msgid "Forget passwords"
+msgstr ""
+
+#: main.cpp:50
+msgid "Specify icon to use in the password dialog"
+msgstr ""
+
+#: main.cpp:51
+msgid "Do not show the command to be run in the dialog"
+msgstr ""
+
+#: main.cpp:52
+msgid "Process priority, between 0 and 100, 0 the lowest [50]"
+msgstr ""
+
+#: main.cpp:53
+msgid "Use realtime scheduling"
+msgstr ""
+
+#: main.cpp:54
+msgid "Use target UID if <file> is not writeable"
+msgstr ""
+
+#: main.cpp:55
+msgid "Fake option for TDE's TdeSu compatibility"
+msgstr ""
+
+#: main.cpp:56
+msgid "Do not keep password"
+msgstr ""
+
+#: main.cpp:57
+msgid "Use existing DCOP server"
+msgstr ""
+
+#: main.cpp:58
+msgid "The comment that should be displayed in the dialog"
+msgstr ""
+
+#: main.cpp:59
+msgid "Do not display « ignore » button"
+msgstr ""
+
+#: main.cpp:99
+msgid ""
+"You must provide the name of the executable you want to run as an argument "
+"to tdesudo"
+msgstr ""
+
+#: tdesudo.cpp:52
+msgid ""
+"<b>%1</b> needs administrative privileges. Please enter your password for "
+"verification."
+msgstr ""
+
+#: tdesudo.cpp:75
+msgid ""
+"No command arguments supplied!\n"
+"Usage: tdesudo [-u <runas>] <command>\n"
+"TdeSudo will now exit..."
+msgstr ""
+
+#: tdesudo.cpp:122
+msgid "&Ignore"
+msgstr ""
+
+#: tdesudo.cpp:249 tdesudo.cpp:261
+msgid "Priority:"
+msgstr ""
+
+#: tdesudo.cpp:249
+msgid "realtime:"
+msgstr ""
+
+#: tdesudo.cpp:307
+msgid "Command:"
+msgstr ""
+
+#: tdesudo.cpp:347
+msgid "Wrong password! Exiting..."
+msgstr ""
+
+#: tdesudo.cpp:354
+msgid "Command not found!"
+msgstr ""
+
+#: tdesudo.cpp:360
+msgid "Your username is unknown to sudo!"
+msgstr ""
+
+#: tdesudo.cpp:366
+msgid "Your user is not allowed to run the specified command!"
+msgstr ""
+
+#: tdesudo.cpp:372 tdesudo.cpp:378
+msgid "Your user is not allowed to run sudo on this host!"
+msgstr ""
-- 
cgit v1.2.3

