1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 14:46:33 +02:00

ship the translations within the binary

build qm-files for translation

create resource file for translations, contains german translations, for now.

this is some kind of hack to make it work. rcc doesn’t allow
out-of-source builds, so the commands need to be specified by hand, to
copy things around between source and binary directories.
This commit is contained in:
Julian Bäume
2011-03-31 00:00:49 +08:00
committed by Christian Muehlhaeuser
parent f5ba469b0a
commit a55124ed75
3 changed files with 33 additions and 1 deletions

5
lang/tomahawk_i18n.qrc Normal file
View File

@@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/lang">
<file>tomahawk_de.qm</file>
</qresource>
</RCC>

25
lang/translations.cmake Normal file
View File

@@ -0,0 +1,25 @@
FILE (GLOB TS_FILES ${CMAKE_SOURCE_DIR}/lang/*.ts)
QT4_ADD_TRANSLATION(QM_FILES ${TS_FILES})
## HACK HACK HACK - around rcc limitations to allow out of source-tree building
SET( trans_file tomahawk_i18n )
SET( trans_srcfile ${CMAKE_SOURCE_DIR}/lang/${trans_file}.qrc)
SET( trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc)
SET( trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${trans_file}.cxx)
# Copy the QRC file to the output directory
ADD_CUSTOM_COMMAND(
OUTPUT ${trans_infile}
COMMAND ${CMAKE_COMMAND} -E copy ${trans_srcfile} ${trans_infile}
MAIN_DEPENDENCY ${trans_srcfile}
)
# Run the resource compiler (rcc_options should already be set)
ADD_CUSTOM_COMMAND(
OUTPUT ${trans_outfile}
COMMAND ${QT_RCC_EXECUTABLE}
ARGS ${rcc_options} -name ${trans_file} -o ${trans_outfile} ${trans_infile}
MAIN_DEPENDENCY ${trans_infile}
DEPENDS ${QM_FILES}
)

View File

@@ -186,7 +186,9 @@ qt4_wrap_cpp( tomahawkMoc ${tomahawkHeaders} )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
SET( final_src ${final_src} ${tomahawkMoc} ${tomahawkSources} ${tomahawkHeaders} )
include( ${CMAKE_SOURCE_DIR}/lang/translations.cmake )
SET( final_src ${final_src} ${tomahawkMoc} ${tomahawkSources} ${tomahawkHeaders} ${trans_outfile})
IF( "${gui}" STREQUAL "no" )
ELSE()