summaryrefslogtreecommitdiff
path: root/po
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-18 11:16:47 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-20 17:52:51 +0200
commitc74052c766df01eafc3cb5f98c46d779bee8b0e9 (patch)
treefb20474973c2e7941a13964b898b7724aa141fed /po
parent5e400c91b7ac292dd8a555c9c2f18075fd778d78 (diff)
downloadmana-c74052c766df01eafc3cb5f98c46d779bee8b0e9.tar.gz
mana-c74052c766df01eafc3cb5f98c46d779bee8b0e9.tar.bz2
mana-c74052c766df01eafc3cb5f98c46d779bee8b0e9.tar.xz
mana-c74052c766df01eafc3cb5f98c46d779bee8b0e9.zip
CMake: Use cmake-format to make the files more pleasant to read
More consistent formatting and no longer everything in uppercase, yay!
Diffstat (limited to 'po')
-rw-r--r--po/CMakeLists.txt164
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}")