Improve po-update to avoid nop updates.

The last change caused a lot of files be updated with the only change
the pot-update header. In the Wesnoth wiki there was a hint to use
msgattrib to cleanup the changes poedit makes. Using this on the file
seems to give the wanted output, proper files and no "dummy" updates.

Ivanovic please test this change.
This commit is contained in:
Mark de Wever 2009-10-11 07:08:49 +00:00
parent b1a94d4a76
commit 9359184556
2 changed files with 16 additions and 3 deletions

View file

@ -22,6 +22,7 @@ Version 1.7.6+svn:
* Fixed "Revert all changes" feature in the map editor (bug #14266)
* Fixed broken illumination overlay in ToD sidebar image
* gui2 dialogs are now shown in an exception safe way
* Improve cmake po-update so it doesn't add too many dummy updates
Version 1.7.6:
* AI:

View file

@ -65,6 +65,11 @@ if(NOT GETTEXT_MSGCAT_EXECUTABLE )
message(FATAL_ERROR "msgcat not found")
endif(NOT GETTEXT_MSGCAT_EXECUTABLE )
find_program(GETTEXT_MSGATTRIB_EXECUTABLE msgattrib)
if(NOT GETTEXT_MSGATTRIB_EXECUTABLE)
message(FATAL_ERROR "msgattrib not found")
endif(NOT GETTEXT_MSGATTRIB_EXECUTABLE)
set(WMLXGETTEXT ${PROJECT_SOURCE_DIR}/utils/wmlxgettext)
############ pot update. ###########
@ -229,15 +234,22 @@ if(ENABLE_POT_UPDATE_TARGET)
# make. We don't make this dummy file but the pot-update
# still works.
OUTPUT ${PROJECT_SOURCE_DIR}/po/${DOMAIN}/${LANG}.po.lang.dummy
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE}
# After the po file is updated it might look not entirely as
# wanted, for example poedit reorders the file. Use msgattrib
# to reformat the file, use a helper file to do so.
COMMAND ${GETTEXT_MSGATTRIB_EXECUTABLE}
--output ${LANG}.po.tmp
${LANG}.po
${DOMAIN}.pot
-o ${LANG}.po.tmp
COMMAND ${CMAKE_COMMAND} -E copy
${LANG}.po.tmp
${LANG}.po
COMMAND ${CMAKE_COMMAND} -E remove
${LANG}.po.tmp
# Now merge with the pot file.
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE}
--backup=none
-U ${LANG}.po
${DOMAIN}.pot
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/po/${DOMAIN}
COMMENT "po-update [${DOMAIN}-${LANG}]: Updated po file."
)