diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2019-01-08 00:06:00 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2019-01-08 01:20:05 +0100 |
commit | 8147f97196ea169d6ce1de58ebdaa85e0569ea23 (patch) | |
tree | 81b34c6bdabaeacdffb4a9f052ed17ebc18efb20 /chalk | |
parent | 36ea4eb8742d580b59849824d9075929ff26d001 (diff) | |
download | koffice-8147f97196ea169d6ce1de58ebdaa85e0569ea23.tar.gz koffice-8147f97196ea169d6ce1de58ebdaa85e0569ea23.zip |
Add CMakeL10n rules.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 60f97e3b91c86febc249259183c57399a7c6b528)
Diffstat (limited to 'chalk')
-rw-r--r-- | chalk/CMakeL10n.txt | 112 | ||||
-rw-r--r-- | chalk/plugins/CMakeL10n.txt | 3 | ||||
-rw-r--r-- | chalk/plugins/viewplugins/CMakeL10n.txt | 3 | ||||
-rw-r--r-- | chalk/plugins/viewplugins/screenshot/CMakeL10n.txt | 3 |
4 files changed, 121 insertions, 0 deletions
diff --git a/chalk/CMakeL10n.txt b/chalk/CMakeL10n.txt new file mode 100644 index 00000000..c82289f8 --- /dev/null +++ b/chalk/CMakeL10n.txt @@ -0,0 +1,112 @@ +################################################# +##### +##### from_hex( HEX DEC ) +##### + +function( from_hex HEX DEC ) + string(SUBSTRING "${HEX}" 2 -1 HEX) + string(TOUPPER "${HEX}" HEX) + set(_res 0) + string(LENGTH "${HEX}" _strlen) + + while(_strlen GREATER 0) + math(EXPR _res "${_res} * 16") + string(SUBSTRING "${HEX}" 0 1 NIBBLE) + string(SUBSTRING "${HEX}" 1 -1 HEX) + if(NIBBLE STREQUAL "A") + math(EXPR _res "${_res} + 10") + elseif(NIBBLE STREQUAL "B") + math(EXPR _res "${_res} + 11") + elseif(NIBBLE STREQUAL "C") + math(EXPR _res "${_res} + 12") + elseif(NIBBLE STREQUAL "D") + math(EXPR _res "${_res} + 13") + elseif(NIBBLE STREQUAL "E") + math(EXPR _res "${_res} + 14") + elseif(NIBBLE STREQUAL "F") + math(EXPR _res "${_res} + 15") + else() + math(EXPR _res "${_res} + ${NIBBLE}") + endif() + + string(LENGTH "${HEX}" _strlen) + endwhile() + + set(${DEC} ${_res} PARENT_SCOPE) +endfunction() + + +##### prepare strings from data files ########### + +file( GLOB_RECURSE _chalk_data_files + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/data/*.ggr + ${CMAKE_CURRENT_SOURCE_DIR}/data/*.gpl + ${CMAKE_CURRENT_SOURCE_DIR}/data/*.gih + ${CMAKE_CURRENT_SOURCE_DIR}/data/*.gbr + ${CMAKE_CURRENT_SOURCE_DIR}/data/*.pat +) +list( SORT _chalk_data_files ) +unset( _chalk_data_l10n ) +foreach( _chalk_file ${_chalk_data_files} ) + + if( "${_chalk_file}" MATCHES "\\.(ggr|gpl)" ) + file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file} _file_data ) + string( REGEX REPLACE "(^|\n)Name: ([^\n]+).*" "\\1i18n(\"\\2\");\\n" _file_l10n "${_file_data}" ) + file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}.tde_l10n "${_file_l10n}" ) + endif( ) + + if( "${_chalk_file}" MATCHES "\\.gih" ) + file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file} _file_data ) + string( REGEX REPLACE "^([^\n]+).*" "i18n(\"\\1\");\\n" _file_l10n "${_file_data}" ) + file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}.tde_l10n "${_file_l10n}" ) + endif( ) + + if( "${_chalk_file}" MATCHES "\\.gbr" ) + file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file} + _file_head LIMIT 4 HEX ) + from_hex( "0x${_file_head}" _file_head_size ) + file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file} + _file_head LIMIT 4 OFFSET 4 HEX ) + from_hex( "0x${_file_head}" _file_head_version ) + if( "${_file_head_version}" EQUAL "1" ) + math( EXPR _file_head_len "${_file_head_size} - 21" ) + file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file} + _file_head LIMIT ${_file_head_len} OFFSET 20 ) + else( ) + math( EXPR _file_head_len "${_file_head_size} - 29" ) + file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file} + _file_head LIMIT ${_file_head_len} OFFSET 28 ) + endif( ) + string( STRIP "${_file_head}" _file_head ) + file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}.tde_l10n + "i18n(\"${_file_head}\");\n" ) + endif( ) + + if( "${_chalk_file}" MATCHES "\\.pat" ) + file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file} + _file_head LIMIT 4 HEX ) + from_hex( "0x${_file_head}" _file_head_size ) + math( EXPR _file_head_len "${_file_head_size} - 25" ) + file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file} + _file_head LIMIT ${_file_head_len} OFFSET 24 ) + string( STRIP "${_file_head}" _file_head ) + file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}.tde_l10n + "i18n(\"${_file_head}\");\n" ) + endif( ) + + list( APPEND _chalk_data_l10n "${_chalk_file}.tde_l10n" ) + +endforeach( ) + + +##### create translation templates ############## + +tde_l10n_create_template( + CATALOG "chalk" + SOURCES + ${_chalk_data_l10n} + "." +) + +tde_l10n_auto_add_subdirectories( ) diff --git a/chalk/plugins/CMakeL10n.txt b/chalk/plugins/CMakeL10n.txt new file mode 100644 index 00000000..b585ce4a --- /dev/null +++ b/chalk/plugins/CMakeL10n.txt @@ -0,0 +1,3 @@ +##### create translation templates ############## + +tde_l10n_auto_add_subdirectories( ) diff --git a/chalk/plugins/viewplugins/CMakeL10n.txt b/chalk/plugins/viewplugins/CMakeL10n.txt new file mode 100644 index 00000000..b585ce4a --- /dev/null +++ b/chalk/plugins/viewplugins/CMakeL10n.txt @@ -0,0 +1,3 @@ +##### create translation templates ############## + +tde_l10n_auto_add_subdirectories( ) diff --git a/chalk/plugins/viewplugins/screenshot/CMakeL10n.txt b/chalk/plugins/viewplugins/screenshot/CMakeL10n.txt new file mode 100644 index 00000000..32852c1a --- /dev/null +++ b/chalk/plugins/viewplugins/screenshot/CMakeL10n.txt @@ -0,0 +1,3 @@ +##### create translation templates ############## + +tde_l10n_create_template( "kscreenshot_plugin" ) |