Add support for LINGUAS.

Use common rules to build documentation.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 3 years ago
parent 455839e360
commit 766f68d408
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -42,6 +42,62 @@ tde_setup_paths( )
option( BUILD_DOC "Build documentation" ON ) option( BUILD_DOC "Build documentation" ON )
option( BUILD_MESSAGES "Build message and GUI translation" ON ) option( BUILD_MESSAGES "Build message and GUI translation" ON )
string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" )
###### build documentations for all languages ###
if( BUILD_DOC )
file( GLOB_RECURSE _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} */doc/* )
foreach( _doc_file IN LISTS _doc_files )
get_filename_component( _dir ${_doc_file} PATH )
list( APPEND _dirs ${_dir} )
endforeach()
if( _dirs )
list( SORT _dirs )
list( REMOVE_DUPLICATES _dirs )
endif()
foreach( _doc_dir IN LISTS _dirs )
string( REGEX REPLACE "/.*" "" _lang ${_doc_dir} )
if( NOT ${_lang} MATCHES "^(html|man|misc|other)$"
AND ( ${_lang} STREQUAL "en" OR
"${_linguas}" MATCHES "^;*$" OR
";${_linguas};" MATCHES ";${_lang};" ))
file( GLOB _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${_doc_dir} ${_doc_dir}/*.docbook )
if( ${_doc_dir} MATCHES "^${_lang}/doc/[^/]*/" )
string( REGEX REPLACE "^${_lang}/doc/(.*)" "\\1" _doc_dest "${_doc_dir}" )
else()
string( REGEX REPLACE "^${_lang}/doc/(.*)" "\\1" _doc_dest "${_doc_dir}/k3b" )
endif()
if( _doc_files )
list( FIND _doc_files "index.docbook" _find_index )
if( -1 EQUAL _find_index )
set( _noindex "NOINDEX" )
else()
unset( _noindex )
endif()
tde_create_handbook(
SOURCE_BASEDIR ${_doc_dir}
${_noindex}
LANG ${_lang}
DESTINATION ${_doc_dest}
)
else()
file( GLOB _doc_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${_doc_dir}/*.css ${_doc_dir}/*.jpg ${_doc_dir}/*.png )
install(
FILES ${_doc_files}
DESTINATION ${HTML_INSTALL_DIR}/${_lang}/${_doc_dest}
)
endif()
endif()
endforeach()
endif()
###### build translations for all languages ##### ###### build translations for all languages #####
@ -49,13 +105,9 @@ if( BUILD_MESSAGES )
file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} */messages/*.po ) file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} */messages/*.po )
foreach( _po ${po_files} ) foreach( _po ${po_files} )
string( REPLACE "/" ";" _path "${_po}" ) string( REGEX REPLACE "/.*" "" _lang ${_po} )
list( GET _path 0 _lang ) if( "${_linguas}" MATCHES "^;*$" OR ";${_linguas};" MATCHES ";${_lang};" )
tde_create_translation( FILES ${_po} LANG ${_lang} ) tde_create_translation( FILES ${_po} LANG ${_lang} )
endif()
endforeach( ) endforeach( )
endif( ) endif( )
###### subdirectories ###########################
tde_auto_add_subdirectories( )

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG da
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG de
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG es
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG et
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG fr
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG it
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG nl
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG pl
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG pt
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG pt_BR
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG ru
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG sv
)

@ -1 +0,0 @@
tde_conditional_add_subdirectory( BUILD_DOC doc )

@ -1,6 +0,0 @@
# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
tde_create_handbook(
DESTINATION k3b
LANG uk
)
Loading…
Cancel
Save