Commit bcbe24c2 authored by Jan Möbius's avatar Jan Möbius

Dennis: Translations

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6715 383ad7c9-94d9-4d36-a494-682f7c89f535
parent fe7dfac1
...@@ -89,28 +89,11 @@ if (APPLE) ...@@ -89,28 +89,11 @@ if (APPLE)
) )
endif () endif ()
# Translations
set (COREAPP_FILES_TO_TRANSLATE ${COREAPP_FILES_TO_TRANSLATE} ${sources} ${ui} ${headers}) set (trans_files ${sources})
list (APPEND trans_files ${ui})
# generate/use translation files list (APPEND trans_files ${headers})
# run with UPDATE_TRANSLATIONS set to on to build qm files acg_add_translations (OpenFlipper "de_DE" "${trans_files}")
option (UPDATE_TRANSLATIONS "Update source translation translations/CoreApp_de_DE.ts files (WARNING: make clean will delete the source .ts files! Danger!)")
if (UPDATE_TRANSLATIONS)
qt4_create_translation(QM_FILES ${COREAPP_FILES_TO_TRANSLATE} translations/CoreApp_de_DE.ts )
else (UPDATE_TRANSLATIONS)
qt4_add_translation(QM_FILES translations/CoreApp_de_DE.ts )
endif (UPDATE_TRANSLATIONS)
# create a target for the translation files ( and object files )
# Use this target, to update only the translations
add_custom_target (translations_target_core DEPENDS ${QM_FILES})
# Build translations with the application
add_dependencies(OpenFlipper translations_target_core )
# Copy all translation files after build
of_copy_translations( OpenFlipper )
# copy all needed files to "Build" directory to allow a direct execution from it # copy all needed files to "Build" directory to allow a direct execution from it
......
...@@ -55,25 +55,10 @@ acg_qt4_automoc (moc_targets ${headers}) ...@@ -55,25 +55,10 @@ acg_qt4_automoc (moc_targets ${headers})
acg_add_library (PluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets}) acg_add_library (PluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})
set (PLUGINLIB_FILES_TO_TRANSLATE ${PLUGINLIB_FILES_TO_TRANSLATE} ${sources} ${ui} ${headers}) set (trans_files ${sources})
# generate/use translation files list (APPEND trans_files ${ui})
# run with UPDATE_TRANSLATIONS set to on to build qm files list (APPEND trans_files ${headers})
option (UPDATE_TRANSLATIONS "Update source translation translations/PluginLib_de_DE.ts files (WARNING: make clean will delete the source .ts files! Danger!)") acg_add_translations (PluginLib "de_DE" "${trans_files}")
if (UPDATE_TRANSLATIONS)
qt4_create_translation(QM_FILES ${PLUGINLIB_FILES_TO_TRANSLATE} translations/PluginLib_de_DE.ts )
else (UPDATE_TRANSLATIONS)
qt4_add_translation(QM_FILES translations/PluginLib_de_DE.ts )
endif (UPDATE_TRANSLATIONS)
# create a target for the translation files ( and object files )
# Use this target, to update only the translations
add_custom_target (translations_target_pluginlib DEPENDS ${QM_FILES})
# Build translations with the application
add_dependencies( PluginLib translations_target_pluginlib )
# Copy all translation files after build
of_copy_translations( PluginLib )
target_link_libraries (PluginLib target_link_libraries (PluginLib
OpenMeshCore OpenMeshCore
......
...@@ -32,20 +32,6 @@ macro (acg_modify_project_dirs) ...@@ -32,20 +32,6 @@ macro (acg_modify_project_dirs)
endif () endif ()
endmacro () endmacro ()
# function to copy all translation files from one directory to the OpenFlipper translation directory
# parameters: BuildTarget .. The command will be executed after the target is build
function ( of_copy_translations _target)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations )
add_custom_command (TARGET ${_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/*.qm
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations/ )
endfunction ()
# search all plugins and add them to build # search all plugins and add them to build
function (of_add_plugins) function (of_add_plugins)
file ( file (
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
# [INCDIRS dir1 dir2 ...] # [INCDIRS dir1 dir2 ...]
# [ADDSRC file1 file2 ...] # [ADDSRC file1 file2 ...]
# [INSTALLDATA dir1 dir2 ...] # [INSTALLDATA dir1 dir2 ...]
# [TRANSLATION_LANGUAGES lang1 lang2 ...]
# [TRANSLATION_ADDFILES file1 file2 ...]
# [LICENSEMANAGER]) # [LICENSEMANAGER])
# #
# DIRS = additional directories with source files # DIRS = additional directories with source files
...@@ -23,6 +25,9 @@ ...@@ -23,6 +25,9 @@
# ADDSRC = additional source files # ADDSRC = additional source files
# INSTALLDATA = directories that will be installed into the openflipper data directory # INSTALLDATA = directories that will be installed into the openflipper data directory
# #
# TRANSLATION_LANGUAGES = language codes for translation
# TRANSLATION_ADDFILES = additional files that should be included into the translation files
#
# LICENSEMANAGER = Compile plugin with license management # LICENSEMANAGER = Compile plugin with license management
# #
# Plugins can implement a acg_list_filter ("listname") macro to filter out # Plugins can implement a acg_list_filter ("listname") macro to filter out
...@@ -41,7 +46,7 @@ endmacro () ...@@ -41,7 +46,7 @@ endmacro ()
# parse plugin macro parameter # parse plugin macro parameter
macro (_get_plugin_parameters _prefix) macro (_get_plugin_parameters _prefix)
set (_current_var _foo) set (_current_var _foo)
set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD LIBRARIES LIBDIRS INCDIRS ADDSRC INSTALLDATA) set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD LIBRARIES LIBDIRS INCDIRS ADDSRC INSTALLDATA TRANSLATION_LANGUAGES TRANSLATION_ADDFILES)
set (_supported_flags LICENSEMANAGER) set (_supported_flags LICENSEMANAGER)
foreach (_val ${_supported_var}) foreach (_val ${_supported_var})
set (${_prefix}_${_val}) set (${_prefix}_${_val})
...@@ -310,6 +315,14 @@ function (_build_openflipper_plugin plugin) ...@@ -310,6 +315,14 @@ function (_build_openflipper_plugin plugin)
endif () endif ()
endforeach () endforeach ()
if (${${_PLUGIN}_TRANSLATION_LANGUAGES})
set (trans_files ${uic_targets})
list (APPEND trans_files ${sources})
list (APPEND trans_files ${headers})
list (APPEND trans_files ${${_PLUGIN}_TRANSLATION_ADDFILES})
acg_add_translation(Plugin-${plugin} ${${_PLUGIN}_TRANSLATION_LANGUAGES} ${trans_files})
endif ()
else () else ()
message (STATUS "[WARNING] One or more dependencies for plugin ${plugin} not found. Skipping plugin.") message (STATUS "[WARNING] One or more dependencies for plugin ${plugin} not found. Skipping plugin.")
message (STATUS "Missing dependencies :${_${_PLUGIN}_MISSING_DEPS}") message (STATUS "Missing dependencies :${_${_PLUGIN}_MISSING_DEPS}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment