diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-06-19 10:10:15 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-06-19 10:10:15 +0200 |
commit | 61d02a395b0ca594640f0fb917d7162a5aba2c37 (patch) | |
tree | 7dd6f7f540dda3d89d37bc7e19f3f4d27dd53c85 /po | |
parent | 5da59b807d9840fb23feb42df729bf5e88ee9678 (diff) | |
parent | ac0b338b3e026d0d05a447894de9a6a994da82dc (diff) | |
download | mana-online-player-list.tar.gz mana-online-player-list.tar.bz2 mana-online-player-list.tar.xz mana-online-player-list.zip |
Merge branch 'master' into online-player-listonline-player-list
Conflicts:
src/net/tmwa/chathandler.cpp
Diffstat (limited to 'po')
-rw-r--r-- | po/CMakeLists.txt | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index f2ae4b93..e0cfc325 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,82 +1,82 @@ -FIND_PACKAGE(Gettext REQUIRED) - -# based on the CMake 2.6.3 GETTEXT_CREATE_TRANSLATIONS -# we need our own version because the upstream one contains -# a call to msgmerge (updating po files) which can't be -# disabled -MACRO(MANA_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) - # make it a real variable, so we can modify it here - SET(_firstPoFile "${_firstPoFileArg}") - - SET(_gmoFiles) - GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE) - GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) - - SET(_addToAll) - IF(${_firstPoFile} STREQUAL "ALL") - SET(_addToAll "ALL") - SET(_firstPoFile) - ENDIF(${_firstPoFile} STREQUAL "ALL") - - FOREACH (_currentPoFile ${_firstPoFile} ${ARGN}) - GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE) - GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH) - GET_FILENAME_COMPONENT(_lang ${_absFile} NAME_WE) - SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) - - ADD_CUSTOM_COMMAND( - OUTPUT ${_gmoFile} - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} - DEPENDS ${_absPotFile} ${_absFile} - ) - - INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) - SET(_gmoFiles ${_gmoFiles} ${_gmoFile}) - - ENDFOREACH (_currentPoFile) - - ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles}) -ENDMACRO() - -MACRO(MANA_GETTEXT_UPDATE_PO _potFile _languages) - GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) - - ADD_CUSTOM_TARGET( - update-pot - COMMAND xgettext --files-from=translatable-files --directory=. --output=${_potFile} -d mana --keyword=_ --keyword=N_ - ) - - ADD_CUSTOM_TARGET( - update-translatable-files - COMMAND grep '_\(' -Irl ../src | sort > translatable-files - ) - - FOREACH(_lang ${_languages}) - GET_FILENAME_COMPONENT(_absFile "${_lang}.po" ABSOLUTE) - SET(_currentPoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po) - ADD_CUSTOM_TARGET( - "update-translation-${_lang}" - COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile} - ) - ADD_DEPENDENCIES("update-translation-${_lang}" update-pot) - ADD_DEPENDENCIES(update-po "update-translation-${_lang}") - ADD_DEPENDENCIES(update-pot update-translatable-files) - ENDFOREACH() -ENDMACRO() - - -SET(languages) -SET(POFILES) -FILE(STRINGS LINGUAS _languages) -FOREACH(_lang ${_languages}) - STRING(REGEX REPLACE "#.*" "" _lang "${_lang}") - IF(NOT ${_lang} STREQUAL "") - SET(languages ${languages} ${_lang}) - SET(POFILES ${POFILES} "${_lang}.po") - ENDIF() -ENDFOREACH() - -ADD_CUSTOM_TARGET(update-po) - -MANA_GETTEXT_CREATE_TRANSLATIONS(mana.pot ALL ${POFILES}) -MANA_GETTEXT_UPDATE_PO(mana.pot "${languages}") +find_package(Gettext REQUIRED) + +# based on the CMake 2.6.3 GETTEXT_CREATE_TRANSLATIONS we need our own version +# because the upstream one contains a call to msgmerge (updating po files) which +# can't be disabled +macro(MANA_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) + # make it a real variable, so we can modify it here + set(_firstPoFile "${_firstPoFileArg}") + + set(_gmoFiles) + get_filename_component(_potBasename ${_potFile} NAME_WE) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) + + set(_addToAll) + if(${_firstPoFile} STREQUAL "ALL") + set(_addToAll "ALL") + set(_firstPoFile) + endif(${_firstPoFile} STREQUAL "ALL") + + foreach(_currentPoFile ${_firstPoFile} ${ARGN}) + get_filename_component(_absFile ${_currentPoFile} ABSOLUTE) + get_filename_component(_abs_PATH ${_absFile} PATH) + get_filename_component(_lang ${_absFile} NAME_WE) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) + + add_custom_command( + OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} + DEPENDS ${_absPotFile} ${_absFile}) + + install( + FILES ${_gmoFile} + DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES + RENAME ${_potBasename}.mo) + set(_gmoFiles ${_gmoFiles} ${_gmoFile}) + + endforeach(_currentPoFile) + + add_custom_target( + translations + ${_addToAll} + DEPENDS ${_gmoFiles}) +endmacro() + +macro(MANA_GETTEXT_UPDATE_PO _potFile _languages) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) + + add_custom_target( + update-pot COMMAND xgettext --files-from=translatable-files --directory=. + --output=${_potFile} -d mana --keyword=_ --keyword=N_) + + add_custom_target(update-translatable-files COMMAND grep '_\(' -Irl ../src | + sort > translatable-files) + + foreach(_lang ${_languages}) + get_filename_component(_absFile "${_lang}.po" ABSOLUTE) + set(_currentPoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po) + add_custom_target( + "update-translation-${_lang}" + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s + ${_absFile} ${_absPotFile}) + add_dependencies("update-translation-${_lang}" update-pot) + add_dependencies(update-po "update-translation-${_lang}") + add_dependencies(update-pot update-translatable-files) + endforeach() +endmacro() + +set(languages) +set(POFILES) +file(STRINGS LINGUAS _languages) +foreach(_lang ${_languages}) + string(REGEX REPLACE "#.*" "" _lang "${_lang}") + if(NOT ${_lang} STREQUAL "") + set(languages ${languages} ${_lang}) + set(POFILES ${POFILES} "${_lang}.po") + endif() +endforeach() + +add_custom_target(update-po) + +mana_gettext_create_translations(mana.pot ALL ${POFILES}) +mana_gettext_update_po(mana.pot "${languages}") |