summaryrefslogtreecommitdiffstats
path: root/tdescreensaver/kxsconfig/CMakeL10n.txt
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2018-12-31 15:09:38 +0100
committerSlávek Banko <[email protected]>2018-12-31 15:38:05 +0100
commita53c14c174db130bf499a5651dd08ff46708566e (patch)
tree80227796103588bdff57be13850871f87cfebf97 /tdescreensaver/kxsconfig/CMakeL10n.txt
parentf5fd24cadcb0874ddf451f40e6fae92686450100 (diff)
downloadtdeartwork-a53c14c174db130bf499a5651dd08ff46708566e.tar.gz
tdeartwork-a53c14c174db130bf499a5651dd08ff46708566e.zip
Add CMakeL10n rules.
Signed-off-by: Slávek Banko <[email protected]> (cherry picked from commit 485325be1bd947153afea451d44cad4fb0c94c81)
Diffstat (limited to 'tdescreensaver/kxsconfig/CMakeL10n.txt')
-rw-r--r--tdescreensaver/kxsconfig/CMakeL10n.txt75
1 files changed, 75 insertions, 0 deletions
diff --git a/tdescreensaver/kxsconfig/CMakeL10n.txt b/tdescreensaver/kxsconfig/CMakeL10n.txt
new file mode 100644
index 00000000..653dae08
--- /dev/null
+++ b/tdescreensaver/kxsconfig/CMakeL10n.txt
@@ -0,0 +1,75 @@
+##### verify required programs ##################
+
+if( NOT DEFINED INTLTOOL_EXTRACT_EXECUTABLE )
+ find_program( INTLTOOL_EXTRACT_EXECUTABLE
+ NAMES intltool-extract
+ HINTS "${TDE_PREFIX}/bin"
+ )
+ if( NOT INTLTOOL_EXTRACT_EXECUTABLE )
+ tde_message_fatal( "intltool-extract is required but not found" )
+ endif( )
+endif( )
+
+
+##### prepare xscreensavers data files ##########
+
+message( STATUS "Prepare to extract strings from xscreensaver data files..." )
+
+include( ../../FindXscreensaver )
+
+unset( _xsavers_l10n )
+file( GLOB _xsaver_files
+ RELATIVE "${XSCREENSAVER_CONFIG_DIR}"
+ ${XSCREENSAVER_CONFIG_DIR}*.xml )
+list( SORT _xsaver_files )
+foreach( _xsaver_file ${_xsaver_files} )
+ string( REGEX REPLACE "\\.xml\$" "" _xsaver_name "${_xsaver_file}" )
+ if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ScreenSavers/${_xsaver_name}.desktop" )
+ file( READ "${XSCREENSAVER_CONFIG_DIR}${_xsaver_file}" _xsaver_xml )
+ string( REGEX REPLACE
+ ".*<screensaver[^>]*_label=\"([^\"]*)\".*" "\\1"
+ _xsaver_label "${_xsaver_xml}" )
+ message( STATUS "Create desktop file for ${_xsaver_label} (${_xsaver_name})" )
+ execute_process(
+ COMMAND ldd "${XSCREENSAVER_DIR}/${_xsaver_name}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ OUTPUT_VARIABLE _xsaver_libs
+ )
+ set( NAME "${_xsaver_name}" )
+ set( LABEL "${_xsaver_label}" )
+ if( "${_xsaver_libs}" MATCHES "libGL" )
+ set( GL1 "X-TDE-Category=OpenGL Screen Savers" )
+ set( GL2 "X-TDE-Type=OpenGL" )
+ else( )
+ set( GL1 "" )
+ set( GL2 "" )
+ endif( )
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/ScreenSavers/xscreensaver.template
+ ${CMAKE_CURRENT_SOURCE_DIR}/ScreenSavers/${_xsaver_name}.desktop
+ @ONLY )
+ endif( )
+
+ execute_process(
+ COMMAND ${INTLTOOL_EXTRACT_EXECUTABLE}
+ --type=gettext/xml --srcdir ${XSCREENSAVER_CONFIG_DIR} ${_xsaver_file}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ScreenSavers
+ OUTPUT_VARIABLE _xsaver_output
+ )
+ file( RENAME
+ "${CMAKE_CURRENT_SOURCE_DIR}/ScreenSavers/${_xsaver_file}.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/ScreenSavers/${_xsaver_file}.h.tde_l10n" )
+ list( APPEND _xsavers_l10n "ScreenSavers/${_xsaver_file}.h.tde_l10n" )
+endforeach( )
+
+
+##### create translation templates ##############
+
+tde_l10n_create_template(
+ CATALOG "kxsconfig"
+ SOURCES
+ "."
+ ${_xsavers_l10n}
+ KEYWORDS
+ N_
+)