summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2021-06-17 18:22:19 +0200
committerSlávek Banko <slavek.banko@axis.cz>2021-06-17 18:22:19 +0200
commit766f68d4084cfcb3f0970fef37c270320a90c390 (patch)
tree5b9dcb5fe70eeb7161eff632166f7d7f70e54875
parent455839e360cf25009f9d662e879179b0eaa50b49 (diff)
downloadk3b-i18n-766f68d4084cfcb3f0970fef37c270320a90c390.tar.gz
k3b-i18n-766f68d4084cfcb3f0970fef37c270320a90c390.zip
Add support for LINGUAS.
Use common rules to build documentation. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--CMakeLists.txt68
-rw-r--r--da/CMakeLists.txt1
-rw-r--r--da/doc/CMakeLists.txt6
-rw-r--r--de/CMakeLists.txt1
-rw-r--r--de/doc/CMakeLists.txt6
-rw-r--r--es/CMakeLists.txt1
-rw-r--r--es/doc/CMakeLists.txt6
-rw-r--r--et/CMakeLists.txt1
-rw-r--r--et/doc/CMakeLists.txt6
-rw-r--r--fr/CMakeLists.txt1
-rw-r--r--fr/doc/CMakeLists.txt6
-rw-r--r--it/CMakeLists.txt1
-rw-r--r--it/doc/CMakeLists.txt6
-rw-r--r--nl/CMakeLists.txt1
-rw-r--r--nl/doc/CMakeLists.txt6
-rw-r--r--pl/CMakeLists.txt1
-rw-r--r--pl/doc/CMakeLists.txt6
-rw-r--r--pt/CMakeLists.txt1
-rw-r--r--pt/doc/CMakeLists.txt6
-rw-r--r--pt_BR/CMakeLists.txt1
-rw-r--r--pt_BR/doc/CMakeLists.txt6
-rw-r--r--ru/CMakeLists.txt1
-rw-r--r--ru/doc/CMakeLists.txt6
-rw-r--r--sv/CMakeLists.txt1
-rw-r--r--sv/doc/CMakeLists.txt6
-rw-r--r--uk/CMakeLists.txt1
-rw-r--r--uk/doc/CMakeLists.txt6
27 files changed, 60 insertions, 99 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f97c40b..5e9b7b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,62 @@ tde_setup_paths( )
option( BUILD_DOC "Build documentation" 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 #####
@@ -49,13 +105,9 @@ if( BUILD_MESSAGES )
file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} */messages/*.po )
foreach( _po ${po_files} )
- string( REPLACE "/" ";" _path "${_po}" )
- list( GET _path 0 _lang )
- tde_create_translation( FILES ${_po} LANG ${_lang} )
+ string( REGEX REPLACE "/.*" "" _lang ${_po} )
+ if( "${_linguas}" MATCHES "^;*$" OR ";${_linguas};" MATCHES ";${_lang};" )
+ tde_create_translation( FILES ${_po} LANG ${_lang} )
+ endif()
endforeach( )
endif( )
-
-
-###### subdirectories ###########################
-
-tde_auto_add_subdirectories( )
diff --git a/da/CMakeLists.txt b/da/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/da/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/da/doc/CMakeLists.txt b/da/doc/CMakeLists.txt
deleted file mode 100644
index 820cfa9..0000000
--- a/da/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG da
-)
diff --git a/de/CMakeLists.txt b/de/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/de/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/de/doc/CMakeLists.txt b/de/doc/CMakeLists.txt
deleted file mode 100644
index 899d10e..0000000
--- a/de/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG de
-)
diff --git a/es/CMakeLists.txt b/es/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/es/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/es/doc/CMakeLists.txt b/es/doc/CMakeLists.txt
deleted file mode 100644
index a140986..0000000
--- a/es/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG es
-)
diff --git a/et/CMakeLists.txt b/et/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/et/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/et/doc/CMakeLists.txt b/et/doc/CMakeLists.txt
deleted file mode 100644
index 6571f00..0000000
--- a/et/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG et
-)
diff --git a/fr/CMakeLists.txt b/fr/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/fr/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/fr/doc/CMakeLists.txt b/fr/doc/CMakeLists.txt
deleted file mode 100644
index 2653a7b..0000000
--- a/fr/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG fr
-)
diff --git a/it/CMakeLists.txt b/it/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/it/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/it/doc/CMakeLists.txt b/it/doc/CMakeLists.txt
deleted file mode 100644
index 4b01c1b..0000000
--- a/it/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG it
-)
diff --git a/nl/CMakeLists.txt b/nl/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/nl/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/nl/doc/CMakeLists.txt b/nl/doc/CMakeLists.txt
deleted file mode 100644
index 3e1a39a..0000000
--- a/nl/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG nl
-)
diff --git a/pl/CMakeLists.txt b/pl/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/pl/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/pl/doc/CMakeLists.txt b/pl/doc/CMakeLists.txt
deleted file mode 100644
index 8a05c4e..0000000
--- a/pl/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG pl
-)
diff --git a/pt/CMakeLists.txt b/pt/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/pt/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/pt/doc/CMakeLists.txt b/pt/doc/CMakeLists.txt
deleted file mode 100644
index 91d4ee2..0000000
--- a/pt/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG pt
-)
diff --git a/pt_BR/CMakeLists.txt b/pt_BR/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/pt_BR/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/pt_BR/doc/CMakeLists.txt b/pt_BR/doc/CMakeLists.txt
deleted file mode 100644
index 71d8b73..0000000
--- a/pt_BR/doc/CMakeLists.txt
+++ /dev/null
@@ -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
-)
diff --git a/ru/CMakeLists.txt b/ru/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/ru/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/ru/doc/CMakeLists.txt b/ru/doc/CMakeLists.txt
deleted file mode 100644
index e9c0d23..0000000
--- a/ru/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG ru
-)
diff --git a/sv/CMakeLists.txt b/sv/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/sv/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/sv/doc/CMakeLists.txt b/sv/doc/CMakeLists.txt
deleted file mode 100644
index 5fb876e..0000000
--- a/sv/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG sv
-)
diff --git a/uk/CMakeLists.txt b/uk/CMakeLists.txt
deleted file mode 100644
index ba78952..0000000
--- a/uk/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-tde_conditional_add_subdirectory( BUILD_DOC doc )
diff --git a/uk/doc/CMakeLists.txt b/uk/doc/CMakeLists.txt
deleted file mode 100644
index 1d207f5..0000000
--- a/uk/doc/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is genereted by trinity-automake-cmake-convert script by Fat-Zer
-
-tde_create_handbook(
- DESTINATION k3b
- LANG uk
-)