Commit 741b08f7 authored by Jarosław Staniek's avatar Jarosław Staniek

make calligra_xgettext more intelligent (+don't create empty pot files)

CCMAIL:aacid@kde.org
parent eba5717d
#! /bin/sh
source ../../calligra_xgettext.sh
XGETTEXT=${XGETTEXT_QT} calligra_xgettext *.cpp *.h > $podir/kdgantt.pot
XGETTEXT=${XGETTEXT_QT} calligra_xgettext kdgantt.pot *.cpp *.h
#
# Helper function for extracting translatable messages from Calligra source code
# Usage example:
# calligra_xgettext `find . -name \*.cpp -o -name \*.h` > $podir/planlibs.pot
# Helper function for extracting translatable messages from Calligra source code.
# Usage: calligra_xgettext <pot-filename-without-path> <source-files-list>
# If there are no messages or the <source-files-list> is empty, the pot file is deleted.
#
# Example usage that creates $podir/myapp.pot file:
# calligra_xgettext myapp.pot `find . -name \*.cpp -o -name \*.h`
#
function calligra_xgettext() {
POTFILE="$podir/$1"
shift
if test -n "$*"; then
calligra_xgettext_internal $* | tee "${POTFILE}" | tail -n1 | grep "^msgstr \"\"\$" > /dev/null \
|| rm -f "${POTFILE}" 2> /dev/null
fi
}
function calligra_xgettext_internal() {
SRC_FILES="$*"
POT_PART_NORMAL="`mktemp $podir/_normal_XXXXXXXX.pot`"
POT_PART_QUNDOFORMAT="`mktemp $podir/_qundoformat_XXXXXXXX.pot`"
......
......@@ -11,5 +11,5 @@ RCFILES=`find . -name \*.rc \
$EXTRACTRC $RCFILES >> rc.cpp
perl extracti18n.pl > i18ndata
# ignore sdk/templates since it contains templates for use a future plugins, none of the strings there will ever be seen by any user
calligra_xgettext i18ndata rc.cpp `find . -name \*.cc -o -name \*.h -o -name \*.cpp | grep -v '/tests/' | grep -v './sdk/templates'` ui/kis_aboutdata.h > $podir/krita.pot
rm -f i18ndata
calligra_xgettext krita.pot i18ndata rc.cpp `find . -name \*.cc -o -name \*.h -o -name \*.cpp | grep -v '/tests/' | grep -v './sdk/templates'` ui/kis_aboutdata.h
rm -f i18ndata rc.cpp
#! /bin/sh
source ../../calligra_xgettext.sh
calligra_xgettext *.cpp > $podir/crashhandler.pot
calligra_xgettext crashhandler.pot *.cpp
......@@ -5,5 +5,5 @@ EXCLUDE="-path ./koproperty -o -path ./db/drivers/sqlite" # TODO: -o -path ./kor
LIST=`find . \( $EXCLUDE \) -prune -o \( -name \*.ui -o -name \*.rc \) -type f -print | grep -v -e '/\.'`
$EXTRACTRC $LIST >> rc.cpp
LIST=`find . \( $EXCLUDE \) -prune -o \( -name \*.cpp -o -name \*.cc -o -name \*.h \) -type f -print | grep -v '/tests/' | grep -v -e '/\.'`
calligra_xgettext $LIST > $podir/calligra.pot
calligra_xgettext calligra.pot $LIST
rm -f rc.cpp
......@@ -14,7 +14,5 @@ LIST=`find . \( $EXCLUDE \) -prune -o \( -name \*.h -o -name \*.cpp -o -name \*.
if ! grep -q '^#warning noi18n ' $f ; then echo $f; fi \
done \
`
if test -n "$LIST"; then
calligra_xgettext $LIST > $podir/$potfile.pot 2> /dev/null
fi
calligra_xgettext $potfile.pot $LIST
rm -f rc.cpp
#! /bin/sh
source $srcdir/../../calligra_xgettext.sh
calligra_xgettext *.cpp editors/*.cpp > $podir/koproperty.pot
calligra_xgettext koproperty.pot *.cpp editors/*.cpp
......@@ -2,4 +2,5 @@
source ../../calligra_xgettext.sh
$EXTRACTRC *.ui >> rc.cpp
calligra_xgettext *.cpp *.h > $podir/ArtisticTextShape.pot
calligra_xgettext ArtisticTextShape.pot *.cpp *.h
rm -f rc.cpp
......@@ -3,3 +3,4 @@ source ../../calligra_xgettext.sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp
calligra_xgettext `find . -name \*.cpp` > $podir/ChartShape.pot
rm -f rc.cpp
#! /bin/sh
source ../../calligra_xgettext.sh
calligra_xgettext `find . -name \*.cpp -o -name \*.h` > $podir/kocolorspaces.pot
calligra_xgettext kocolorspaces.pot `find . -name \*.cpp -o -name \*.h`
#! /bin/sh
source ../../calligra_xgettext.sh
calligra_xgettext *.cpp > $podir/CommentShape.pot
calligra_xgettext CommentShape.pot *.cpp
......@@ -2,4 +2,5 @@
source ../../calligra_xgettext.sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp
calligra_xgettext *.cpp */*.cpp > $podir/calligra-defaulttools.pot
calligra_xgettext calligra-defaulttools.pot *.cpp */*.cpp
rm -f rc.cpp
#! /bin/sh
source ../../calligra_xgettext.sh
calligra_xgettext `find . -name \*.cpp` > $podir/calligra-dockers.pot
calligra_xgettext calligra-dockers.pot `find . -name \*.cpp`
......@@ -2,5 +2,5 @@
source ../../calligra_xgettext.sh
$EXTRACTRC *.ui >> rc.cpp
calligra_xgettext *.cpp *.h elements/*.cpp elements/*.h > $podir/FormulaShape.pot
calligra_xgettext FormulaShape.pot *.cpp *.h elements/*.cpp elements/*.h
rm -f rc.cpp
......@@ -2,9 +2,5 @@
source ../../../calligra_xgettext.sh
$EXTRACTRC *.rc *.ui >> rc.cpp
calligra_xgettext `find . -name \*.cpp` > $podir/keximigrate_spreadsheet.pot
if [ ! -s $podir/keximigrate_spreadsheet.pot ]; then
rm -f $podir/keximigrate_spreadsheet.pot
fi
calligra_xgettext keximigrate_spreadsheet.pot `find . -name \*.cpp`
rm -f rc.cpp
......@@ -2,4 +2,5 @@
source ../../calligra_xgettext.sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11
calligra_xgettext `find . -name \*.cpp -o -name \*.cc` > $podir/MusicShape.pot
calligra_xgettext MusicShape.pot `find . -name \*.cpp -o -name \*.cc`
rm -f rc.cpp
......@@ -2,4 +2,5 @@
source ../../calligra_xgettext.sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11
calligra_xgettext `find . -name \*.cpp -o -name \*.cc` > $podir/PathShapes.pot
calligra_xgettext PathShapes.pot `find . -name \*.cpp -o -name \*.cc`
rm -f rc.cpp
......@@ -2,4 +2,5 @@
source ../../calligra_xgettext.sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11
calligra_xgettext `find . -name \*.cpp` > $podir/PictureShape.pot
calligra_xgettext PictureShape.pot `find . -name \*.cpp`
rm -f rc.cpp
#! /bin/sh
source ../../calligra_xgettext.sh
calligra_xgettext *.cpp > $podir/PluginShape.pot
calligra_xgettext PluginShape.pot *.cpp
#! /bin/sh
source ../../../calligra_xgettext.sh
calligra_xgettext `find . -name \*.cpp` > $podir/koreport_barcodeplugin.pot
calligra_xgettext koreport_barcodeplugin.pot `find . -name \*.cpp`
#! /bin/sh
source ../../../calligra_xgettext.sh
calligra_xgettext `find . -name \*.cpp` > $podir/koreport_chartplugin.pot
calligra_xgettext koreport_chartplugin.pot `find . -name \*.cpp`
#! /bin/sh
source ../../../calligra_xgettext.sh
calligra_xgettext `find . -name \*.cpp` > $podir/koreport_mapsplugin.pot
calligra_xgettext koreport_mapsplugin.pot `find . -name \*.cpp`
#! /bin/sh
source ../../../calligra_xgettext.sh
calligra_xgettext `find . -name \*.cpp` > $podir/koreport_webplugin.pot
calligra_xgettext koreport_webplugin.pot `find . -name \*.cpp`
......@@ -2,4 +2,5 @@
source ../../../calligra_xgettext.sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp
calligra_xgettext `find . -name \*.cpp` > $podir/calligra_semanticitem_contact.pot
calligra_xgettext calligra_semanticitem_contact.pot `find . -name \*.cpp`
rm -f rc.cpp
......@@ -2,4 +2,5 @@
source ../../../calligra_xgettext.sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp
calligra_xgettext `find . -name \*.cpp` > $podir/calligra_semanticitem_event.pot
calligra_xgettext calligra_semanticitem_event.pot `find . -name \*.cpp`
rm -f rc.cpp
......@@ -2,4 +2,5 @@
source ../../../calligra_xgettext.sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp
calligra_xgettext `find . -name \*.cpp` > $podir/calligra_semanticitem_location.pot
calligra_xgettext calligra_semanticitem_location.pot `find . -name \*.cpp`
rm -f rc.cpp
......@@ -2,5 +2,5 @@
source ../../../calligra_xgettext.sh
$EXTRACTRC *.rc *.ui >> rc.cpp
calligra_xgettext *.cpp > $podir/googledocs_plugin.pot
calligra_xgettext googledocs_plugin.pot *.cpp
rm -f rc.cpp
......@@ -2,5 +2,5 @@
source ../../../calligra_xgettext.sh
$EXTRACTRC *.rc *.ui >> rc.cpp
calligra_xgettext *.cpp > $podir/sheetspivottables_plugin.pot
calligra_xgettext sheetspivottables_plugin.pot *.cpp
rm -f rc.cpp
#! /bin/sh
source ../../../calligra_xgettext.sh
calligra_xgettext *.cpp > $podir/TemplateShape.pot
calligra_xgettext TemplateShape.pot *.cpp
#! /bin/sh
source ../../../calligra_xgettext.sh
calligra_xgettext *.cpp > $podir/ThreedShape.pot
calligra_xgettext ThreedShape.pot *.cpp
......@@ -2,4 +2,5 @@
source ../../../calligra_xgettext.sh
$EXTRACTRC *.ui >> rc.cpp
calligra_xgettext *.cpp > $podir/AutocorrectPlugin.pot
calligra_xgettext AutocorrectPlugin.pot *.cpp
rm -f rc.cpp
#! /bin/sh
source ../../../calligra_xgettext.sh
calligra_xgettext *.cpp > $podir/ChangecasePlugin.pot
calligra_xgettext ChangecasePlugin.pot *.cpp
......@@ -2,4 +2,5 @@
source ../../../calligra_xgettext.sh
$EXTRACTRC --tag=string *.ui >> rc.cpp
calligra_xgettext *.cpp > $podir/SpellCheckPlugin.pot
calligra_xgettext SpellCheckPlugin.pot *.cpp
rm -f rc.cpp
#! /bin/sh
source ../../../calligra_xgettext.sh
calligra_xgettext *.cpp > $podir/thesaurus_tool.pot
calligra_xgettext thesaurus_tool.pot *.cpp
......@@ -2,5 +2,5 @@
source ../../calligra_xgettext.sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11
calligra_xgettext `find . -name \*.cpp` > $podir/TextShape.pot
calligra_xgettext TextShape.pot `find . -name \*.cpp`
rm -f rc.cpp
......@@ -2,4 +2,5 @@
source ../../calligra_xgettext.sh
$EXTRACTRC *.ui >> rc.cpp
calligra_xgettext *.cpp *.ui > $podir/VariablesPlugin.pot
calligra_xgettext VariablesPlugin.pot *.cpp *.ui
rm -f rc.cpp
#! /bin/sh
source ../../calligra_xgettext.sh
calligra_xgettext *.cpp > $podir/VectorShape.pot
calligra_xgettext VectorShape.pot *.cpp
......@@ -2,4 +2,5 @@
source ../../calligra_xgettext.sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11
calligra_xgettext `find . -name \*.cpp` > $podir/VideoShape.pot
calligra_xgettext VideoShape.pot `find . -name \*.cpp`
rm -f rc.cpp
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