parent
25794f3459
commit
cf1878b64e
@ -1,9 +0,0 @@
|
|||||||
build*/
|
|
||||||
|
|
||||||
# Vim.gitignore
|
|
||||||
[._]*.s[a-w][a-z]
|
|
||||||
[._]s[a-w][a-z]
|
|
||||||
*.un~
|
|
||||||
Session.vim
|
|
||||||
.netrwhist
|
|
||||||
*~
|
|
@ -1,107 +0,0 @@
|
|||||||
#=============================================================================
|
|
||||||
# The lxqt_translate_desktop() function was copied from the the
|
|
||||||
# LXQt LxQtTranste.cmake
|
|
||||||
#
|
|
||||||
# Original Author: Alexander Sokolov <sokoloff.a@gmail.com>
|
|
||||||
#
|
|
||||||
# funtion lxqt_translate_desktop(_RESULT
|
|
||||||
# SOURCES <sources>
|
|
||||||
# [TRANSLATION_DIR] translation_directory
|
|
||||||
# )
|
|
||||||
# Output:
|
|
||||||
# _RESULT The generated .desktop (.desktop) files
|
|
||||||
#
|
|
||||||
# Input:
|
|
||||||
#
|
|
||||||
# SOURCES List of input desktop files (.destktop.in) to be translated
|
|
||||||
# (merged), relative to the CMakeList.txt.
|
|
||||||
#
|
|
||||||
# TRANSLATION_DIR Optional path to the directory with the .ts files,
|
|
||||||
# relative to the CMakeList.txt. Defaults to
|
|
||||||
# "translations".
|
|
||||||
#
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
function(lxqt_translate_desktop _RESULT)
|
|
||||||
# Parse arguments ***************************************
|
|
||||||
set(oneValueArgs TRANSLATION_DIR)
|
|
||||||
set(multiValueArgs SOURCES)
|
|
||||||
|
|
||||||
cmake_parse_arguments(_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
||||||
|
|
||||||
# check for unknown arguments
|
|
||||||
set(_UNPARSED_ARGS ${_ARGS_UNPARSED_ARGUMENTS})
|
|
||||||
if (NOT ${_UNPARSED_ARGS} STREQUAL "")
|
|
||||||
MESSAGE(FATAL_ERROR
|
|
||||||
"Unknown arguments '${_UNPARSED_ARGS}'.\n"
|
|
||||||
"See lxqt_translate_desktop() documenation for more information.\n"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED _ARGS_SOURCES)
|
|
||||||
set(${_RESULT} "" PARENT_SCOPE)
|
|
||||||
return()
|
|
||||||
else()
|
|
||||||
set(_sources ${_ARGS_SOURCES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED _ARGS_TRANSLATION_DIR)
|
|
||||||
set(_translationDir "translations")
|
|
||||||
else()
|
|
||||||
set(_translationDir ${_ARGS_TRANSLATION_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
get_filename_component (_translationDir ${_translationDir} ABSOLUTE)
|
|
||||||
|
|
||||||
foreach (_inFile ${_sources})
|
|
||||||
get_filename_component(_inFile ${_inFile} ABSOLUTE)
|
|
||||||
get_filename_component(_fileName ${_inFile} NAME_WE)
|
|
||||||
#Extract the real extension ............
|
|
||||||
get_filename_component(_fileExt ${_inFile} EXT)
|
|
||||||
string(REPLACE ".in" "" _fileExt ${_fileExt})
|
|
||||||
#.......................................
|
|
||||||
set(_outFile "${CMAKE_CURRENT_BINARY_DIR}/${_fileName}${_fileExt}")
|
|
||||||
|
|
||||||
file(GLOB _translations
|
|
||||||
${_translationDir}/${_fileName}_*${_fileExt}
|
|
||||||
${_translationDir}/local/${_fileName}_*${_fileExt}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(_pattern "'\\[.*]\\s*='")
|
|
||||||
if (_translations)
|
|
||||||
add_custom_command(OUTPUT ${_outFile}
|
|
||||||
COMMAND grep -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
|
|
||||||
COMMAND grep -h ${_pattern} ${_translations} >> ${_outFile}
|
|
||||||
COMMENT "Generating ${_fileName}${_fileExt}"
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
add_custom_command(OUTPUT ${_outFile}
|
|
||||||
COMMAND grep -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
|
|
||||||
COMMENT "Generating ${_fileName}${_fileExt}"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(__result ${__result} ${_outFile})
|
|
||||||
|
|
||||||
|
|
||||||
# TX file ***********************************************
|
|
||||||
set(_txFile "${CMAKE_BINARY_DIR}/tx/${_fileName}${_fileExt}.tx.sh")
|
|
||||||
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" _tx_translationDir ${_translationDir})
|
|
||||||
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" _tx_inFile ${_inFile})
|
|
||||||
string(REPLACE "." "" _fileType ${_fileExt})
|
|
||||||
|
|
||||||
file(WRITE ${_txFile}
|
|
||||||
"[ -f ${_inFile} ] || exit 0\n"
|
|
||||||
"echo '[lxde-qt.${_fileName}_${_fileType}]'\n"
|
|
||||||
"echo 'type = DESKTOP'\n"
|
|
||||||
"echo 'source_lang = en'\n"
|
|
||||||
"echo 'source_file = ${_tx_inFile}'\n"
|
|
||||||
"echo 'file_filter = ${_tx_translationDir}/${_fileName}_<lang>${_fileExt}'\n"
|
|
||||||
"echo ''\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(${_RESULT} ${__result} PARENT_SCOPE)
|
|
||||||
endfunction(lxqt_translate_desktop)
|
|
@ -1,131 +0,0 @@
|
|||||||
#=============================================================================
|
|
||||||
# Copyright 2014 Luís Pereira <luis.artur.pereira@gmail.com>
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# 3. The name of the author may not be used to endorse or promote products
|
|
||||||
# derived from this software without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#=============================================================================
|
|
||||||
#
|
|
||||||
# funtion lxqt_translate_ts(qmFiles
|
|
||||||
# [USE_QT5 [Yes | No]]
|
|
||||||
# [UPDATE_TRANSLATIONS [Yes | No]]
|
|
||||||
# SOURCES <sources>
|
|
||||||
# [TEMPLATE] translation_template
|
|
||||||
# [TRANSLATION_DIR] translation_directory
|
|
||||||
# [INSTALL_DIR] install_directory
|
|
||||||
# )
|
|
||||||
# Output:
|
|
||||||
# qmFiles The generated compiled translations (.qm) files
|
|
||||||
#
|
|
||||||
# Input:
|
|
||||||
# USE_QT5 Optional flag to choose between Qt4 and Qt5. Defaults to Qt5
|
|
||||||
#
|
|
||||||
# UPDATE_TRANSLATIONS Optional flag. Setting it to Yes, extracts and
|
|
||||||
# compiles the translations. Setting it No, only
|
|
||||||
# compiles them.
|
|
||||||
#
|
|
||||||
# TEMPLATE Optional translations files base name. Defaults to
|
|
||||||
# ${PROJECT_NAME}. An .ts extensions is added.
|
|
||||||
#
|
|
||||||
# TRANSLATION_DIR Optional path to the directory with the .ts files,
|
|
||||||
# relative to the CMakeList.txt. Defaults to
|
|
||||||
# "translations".
|
|
||||||
#
|
|
||||||
# INSTALL_DIR Optional destination of the file compiled files (qmFiles).
|
|
||||||
# If not present no installation is performed
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# CMake v2.8.3 needed to use the CMakeParseArguments module
|
|
||||||
cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
|
|
||||||
|
|
||||||
# We use our patched version to round a annoying bug.
|
|
||||||
include(Qt5PatchedLinguistToolsMacros)
|
|
||||||
|
|
||||||
function(lxqt_translate_ts qmFiles)
|
|
||||||
set(oneValueArgs USE_QT5 UPDATE_TRANSLATIONS TEMPLATE TRANSLATION_DIR INSTALL_DIR)
|
|
||||||
set(multiValueArgs SOURCES)
|
|
||||||
cmake_parse_arguments(TR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
||||||
|
|
||||||
if (NOT DEFINED TR_UPDATE_TRANSLATIONS)
|
|
||||||
set(TR_UPDATE_TRANSLATIONS "No")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED TR_USE_QT5)
|
|
||||||
set(TR_USE_QT5 "Yes")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT DEFINED TR_TEMPLATE)
|
|
||||||
set(TR_TEMPLATE "${PROJECT_NAME}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED TR_TRANSLATION_DIR)
|
|
||||||
set(TR_TRANSLATION_DIR "translations")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
file(GLOB tsFiles "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}_*.ts")
|
|
||||||
set(templateFile "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}.ts")
|
|
||||||
|
|
||||||
if(TR_USE_QT5)
|
|
||||||
# Qt5
|
|
||||||
if (TR_UPDATE_TRANSLATIONS)
|
|
||||||
qt5_patched_create_translation(QMS
|
|
||||||
${TR_SOURCES}
|
|
||||||
${templateFile}
|
|
||||||
OPTIONS -locations absolute
|
|
||||||
)
|
|
||||||
qt5_patched_create_translation(QM
|
|
||||||
${TR_SOURCES}
|
|
||||||
${tsFiles}
|
|
||||||
OPTIONS -locations absolute
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
qt5_patched_add_translation(QM ${tsFiles})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
# Qt4
|
|
||||||
if(TR_UPDATE_TRANSLATIONS)
|
|
||||||
qt4_create_translation(QMS
|
|
||||||
${TR_SOURCES}
|
|
||||||
${templateFile}
|
|
||||||
OPTIONS -locations absolute
|
|
||||||
)
|
|
||||||
qt4_create_translation(QM
|
|
||||||
${TR_SOURCES}
|
|
||||||
${tsFiles}
|
|
||||||
OPTIONS -locations absolute
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
qt4_add_translation(QM ${tsFiles})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TR_UPDATE_TRANSLATIONS)
|
|
||||||
add_custom_target("update_${TR_TEMPLATE}_ts" ALL DEPENDS ${QMS})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(DEFINED TR_INSTALL_DIR)
|
|
||||||
install(FILES ${QM} DESTINATION ${TR_INSTALL_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(${qmFiles} ${QM} PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
@ -1,112 +0,0 @@
|
|||||||
#=============================================================================
|
|
||||||
# Copyright 2005-2011 Kitware, Inc.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# * Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
#
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
#
|
|
||||||
# * Neither the name of Kitware, Inc. nor the names of its
|
|
||||||
# contributors may be used to endorse or promote products derived
|
|
||||||
# from this software without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
include(CMakeParseArguments)
|
|
||||||
|
|
||||||
function(QT5_PATCHED_CREATE_TRANSLATION _qm_files)
|
|
||||||
set(options)
|
|
||||||
set(oneValueArgs)
|
|
||||||
set(multiValueArgs OPTIONS)
|
|
||||||
|
|
||||||
cmake_parse_arguments(_LUPDATE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
||||||
set(_lupdate_files ${_LUPDATE_UNPARSED_ARGUMENTS})
|
|
||||||
set(_lupdate_options ${_LUPDATE_OPTIONS})
|
|
||||||
|
|
||||||
set(_my_sources)
|
|
||||||
set(_my_tsfiles)
|
|
||||||
foreach(_file ${_lupdate_files})
|
|
||||||
get_filename_component(_ext ${_file} EXT)
|
|
||||||
get_filename_component(_abs_FILE ${_file} ABSOLUTE)
|
|
||||||
if(_ext MATCHES "ts")
|
|
||||||
list(APPEND _my_tsfiles ${_abs_FILE})
|
|
||||||
else()
|
|
||||||
list(APPEND _my_sources ${_abs_FILE})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
foreach(_ts_file ${_my_tsfiles})
|
|
||||||
if(_my_sources)
|
|
||||||
# make a list file to call lupdate on, so we don't make our commands too
|
|
||||||
# long for some systems
|
|
||||||
# get_filename_component(_ts_name ${_ts_file} NAME_WE)
|
|
||||||
|
|
||||||
get_filename_component(_name ${_ts_file} NAME)
|
|
||||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _ts_name ${_name})
|
|
||||||
|
|
||||||
set(_ts_lst_file "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lst_file")
|
|
||||||
set(_lst_file_srcs)
|
|
||||||
foreach(_lst_file_src ${_my_sources})
|
|
||||||
set(_lst_file_srcs "${_lst_file_src}\n${_lst_file_srcs}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES)
|
|
||||||
foreach(_pro_include ${_inc_DIRS})
|
|
||||||
get_filename_component(_abs_include "${_pro_include}" ABSOLUTE)
|
|
||||||
set(_lst_file_srcs "-I${_pro_include}\n${_lst_file_srcs}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
file(WRITE ${_ts_lst_file} "${_lst_file_srcs}")
|
|
||||||
endif()
|
|
||||||
add_custom_command(OUTPUT ${_ts_file}
|
|
||||||
COMMAND ${Qt5_LUPDATE_EXECUTABLE}
|
|
||||||
ARGS ${_lupdate_options} "@${_ts_lst_file}" -ts ${_ts_file}
|
|
||||||
DEPENDS ${_my_sources} ${_ts_lst_file} VERBATIM)
|
|
||||||
endforeach()
|
|
||||||
qt5_patched_add_translation(${_qm_files} ${_my_tsfiles})
|
|
||||||
set(${_qm_files} ${${_qm_files}} PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
|
|
||||||
function(QT5_PATCHED_ADD_TRANSLATION _qm_files)
|
|
||||||
foreach(_current_FILE ${ARGN})
|
|
||||||
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
|
|
||||||
# get_filename_component(qm ${_abs_FILE} NAME_WE)
|
|
||||||
|
|
||||||
get_filename_component(_name ${_abs_FILE} NAME)
|
|
||||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" qm ${_name})
|
|
||||||
|
|
||||||
get_source_file_property(output_location ${_abs_FILE} OUTPUT_LOCATION)
|
|
||||||
if(output_location)
|
|
||||||
file(MAKE_DIRECTORY "${output_location}")
|
|
||||||
set(qm "${output_location}/${qm}.qm")
|
|
||||||
else()
|
|
||||||
set(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${qm}
|
|
||||||
COMMAND ${Qt5_LRELEASE_EXECUTABLE}
|
|
||||||
ARGS ${_abs_FILE} -qm ${qm}
|
|
||||||
DEPENDS ${_abs_FILE} VERBATIM
|
|
||||||
)
|
|
||||||
list(APPEND ${_qm_files} ${qm})
|
|
||||||
endforeach()
|
|
||||||
set(${_qm_files} ${${_qm_files}} PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue