Add CMakeL10n rules.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 707d60c602)
pull/16/head
Slávek Banko 6 years ago
parent 9a06da7515
commit a07b08c92d
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -0,0 +1,96 @@
#################################################
#
# (C) 2018 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 )
##### set directory for POT files ###############
set( POT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../tde-i18n/template/messages/tdelibs" )
##### verify tqt3 sources #######################
if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/tqt3/src )
tde_message_fatal( "TQt3 source code is required but not found" )
endif( )
##### prepare tqt3/src/xml/qxml.cpp #############
if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/tqt3/src/xml/qxml.cpp )
# hide "#define" to allow strings to be extracted using xgettext
file( READ ${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/tqt3/src/xml/qxml.cpp _tqt_qxml )
string( REGEX REPLACE "\n(#define[^\n]*)(QT_TRANSLATE_NOOP)" "\n/*\\1*/\\2" _tqt_qxml ${_tqt_qxml} )
file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/tqt3/src/xml/qxml.cpp.tde_l10n "${_tqt_qxml}" )
endif( )
##### generate tdeabc/addressee files ###########
execute_process(
COMMAND perl ./makeaddressee
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tdeabc/scripts
)
##### create translation templates ##############
tde_l10n_create_template(
CATALOG "tdelibs"
SOURCES
"."
"tdecore/tde-config.cpp.cmake"
"../dependencies/tqt3/src"
"../dependencies/tqt3/src/xml/qxml.cpp.tde_l10n"
EXCLUDES
"/test/" "/tests/"
"^arts/kde/mcop-dcop/"
"^arts/knotify/"
"^interfaces/tdemediaplayer/tdefileaudiopreview/"
"^kate/"
"^kdoctools/"
"^libtdescreensaver/"
"^tdeabc/formats/"
"^tdeabc/plugins/"
"^tdecmshell/"
"^tdecore/tdeconfig_compiler/example/"
"^tdeio/"
"^tdeioslave/"
"^tdeprint/"
"^tdeui/colors/"
"^tdestyles/.*/config/"
"/dependencies/tqt3/src/xml/qxml.cpp$"
KEYWORDS
tr tr:1,2
translate translate:1,2
QT_TRANSLATE_NOOP QT_TRANSLATE_NOOP:1,2
)
##### clenaup tdeabc/addressee files ############
file( REMOVE
${CMAKE_CURRENT_SOURCE_DIR}/tdeabc/addressee.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tdeabc/addressee.h
${CMAKE_CURRENT_SOURCE_DIR}/tdeabc/field.cpp
)
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "kmcop" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "knotify" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdefileaudiopreview" )

@ -0,0 +1,11 @@
##### create translation templates ##############
tde_l10n_create_template(
CATALOG "katepart"
SOURCES data part plugins
ATTRIBUTES
"data/*.xml:language,section,Language Section"
"data/*.xml:language,name,Language"
)
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdetexteditor_autobookmarker" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdetexteditor_insertfile" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdetexteditor_isearch" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdetexteditor_kdatatool" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdetexteditor_docwordcompletion" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdeio_help" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "libtdescreensaver" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdeabcformat_binary" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdeabc_dir" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdeabc_file" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdeabc_ldaptdeio" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdeabc_net" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdeabc_sql" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdecmshell" )

@ -0,0 +1,8 @@
##### create translation templates ##############
tde_l10n_create_template(
CATALOG "tdeio"
SOURCES "." "../tdeioslave"
)
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdeioexec" )

@ -0,0 +1,8 @@
##### create translation templates ##############
tde_l10n_create_template(
CATALOG "tdeprint"
EXCLUDES "^cups/cupsdconf2/"
)
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,40 @@
##### prepare cupsd.conf.template as C source ###
set( _conf_context "Do not translate the keyword between brackets (e.g. ServerName, ServerAdmin, etc.)" )
file( READ ${CMAKE_CURRENT_SOURCE_DIR}/cupsd.conf.template _conf_template )
string( REGEX REPLACE "[^\n]" "" _conf_len "${_conf_template}" )
string( LENGTH "+${_conf_len}" _conf_len )
unset( _conf_comment )
unset( _conf_l10n )
set( _conf_pos 0 )
while( _conf_pos LESS ${_conf_len} )
string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _conf_line "${_conf_template}" )
string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\2" _conf_template "${_conf_template}" )
math( EXPR _conf_pos "${_conf_pos}+1" )
if( _conf_comment )
if( "${_conf_line}" MATCHES "^\\$\\$" OR "${_conf_line}" MATCHES "^@@" )
unset( _conf_comment )
set( _conf_line ");" )
else( )
string( REGEX REPLACE "\\\"" "\\\\\"" _conf_line "${_conf_line}" )
string( REGEX REPLACE "^# +(.*)$" "\"\\1\\\\n\"" _conf_line "${_conf_line}" )
endif( )
else( )
if( "${_conf_line}" MATCHES "^%%" AND NOT "${_conf_line}" STREQUAL "%%header" )
set( _conf_comment 1 )
set( _conf_line "i18n(\"${_conf_context}\"," )
else( )
set( _conf_line "" )
endif( )
endif( )
set( _conf_l10n "${_conf_l10n}${_conf_line}\n" )
endwhile( )
file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/cupsd.conf.template.tde_l10n "${_conf_l10n}" )
##### create translation templates ##############
tde_l10n_create_template(
CATALOG "cupsdconf"
SOURCES "." cupsd.conf.template.tde_l10n
)

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdestyle_highcontrast_config" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdestyle_plastik_config" )

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_auto_add_subdirectories( )

@ -0,0 +1,22 @@
##### prepare rgb.txt as C source ###############
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/rgb.txt" _colorsRC )
string( REGEX REPLACE
"([ \t]*([0-9]+[ \t]+)([0-9]+[ \t]+)([0-9]+[ \t]+))([^ \t\n]+)(\n|$)"
"\\1/* xgettext: no-c-format */i18n(\"color\", \"\\5\");\\6"
_colorsRC ${_colorsRC}
)
string( REGEX REPLACE
"[^\n]*gr[ae]y[^\n]*(\n|$)"
"\\1"
_colorsRC ${_colorsRC}
)
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/rgb.txt.tde_l10n" "${_colorsRC}" )
##### create translation templates ##############
tde_l10n_create_template(
CATALOG "tdelibs_colors"
SOURCES rgb.txt.tde_l10n
)
Loading…
Cancel
Save