PO to TS conversion works well as script.

It must only be done if a PO based translator
updates the translation once by me.
This commit is contained in:
Christian Hohnstaedt 2021-05-22 10:16:47 +02:00 committed by Christian Hohnstädt
parent a233ec89f9
commit f09589f610
2 changed files with 14 additions and 20 deletions

View File

@ -3,8 +3,9 @@ set(TS_FILES
xca_fr.ts xca_ja.ts xca_pt_BR.ts xca_tr.ts
xca_de.ts xca_hr.ts xca_nl.ts xca_ru.ts
xca_es.ts xca_it.ts xca_pl.ts xca_sk.ts
xca_zh_CN.ts
xca_zh_CN.ts xca.ts
)
qt5_add_translation(QM_FILES ${TS_FILES})
list(APPEND APP_RESOURCES ${QM_FILES})
set(APP_RESOURCES ${APP_RESOURCES} PARENT_SCOPE)
@ -18,20 +19,10 @@ if (UNIX)
)
endif()
macro(PO_language lang)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/xca_${lang}X.ts"
COMMAND ${LCONVERT} -if po -of ts
-i "${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po"
-o "${CMAKE_CURRENT_SOURCE_DIR}/xca_${lang}X.ts"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po"
)
list(APPEND POTS "${CMAKE_CURRENT_SOURCE_DIR}/xca_${lang}.ts")
endmacro()
find_program(LCONVERT lconvert)
if (LCONVERT)
# cmake -DTRANS=1 ../xca && make trans
if (LCONVERT AND TRANS)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/xca.pot"
COMMAND ${LCONVERT} -if ts -of po
@ -41,12 +32,8 @@ if (LCONVERT)
COMMENT "Update POT file"
)
qt5_create_translation(CQM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
PO_language(tr)
PO_language(fr)
PO_language(sk)
endif()
add_custom_target(trans DEPENDS ${CQM_FILES}
add_custom_target(trans DEPENDS ${CQM_FILES}
"${CMAKE_CURRENT_SOURCE_DIR}/xca.pot"
)
add_custom_target(po2ts DEPENDS ${POTS})
)
endif()

7
lang/po2ts.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
ALL="$@"
test -n "$ALL" || ALL="tr fr sk"
for lang in $ALL; do
lconvert -if po -of ts -i "${lang}.po" -o "xca_${lang}.ts"
done