Browse Source

ABI is not required for Gettext files generation because of Project-Id-Version

is not used as identifier but '*.gmo' filename is used.
master
Kolan Sh 5 years ago
parent
commit
d4e233ae72
1 changed files with 6 additions and 7 deletions
  1. +6
    -7
      update-po.sh

+ 6
- 7
update-po.sh View File

@@ -17,10 +17,9 @@ C_FILELIST="`find */ -type f -regex '.*\.\(h\|hxx\|hpp\|c\|cxx\|cpp\|vala\)$' 2>

PROJECT_LOWERCASE_NAME=`grep '\<SET *(PROJECT_LOWERCASE_NAME\>' "$PRJ_PATH"/CMakeLists.txt | sed 's~.*"\(.*\)".*~\1~'`
MAJOR=`grep '\<SET *(MAJOR\>' "$PRJ_PATH"/CMakeLists.txt | sed 's~.*\([0-9]\+\).*~\1~'`
PROJECT_LOWERCASE_NAME_ABI="$PROJECT_LOWERCASE_NAME-$MAJOR"

mkdir -p $PO_DIR_NAME
xgettext --language=C --escape --package-name=$PROJECT_LOWERCASE_NAME_ABI --default-domain=$PROJECT_LOWERCASE_NAME_ABI --add-comments=/// \
xgettext --language=C --escape --package-name=$PROJECT_LOWERCASE_NAME --default-domain=$PROJECT_LOWERCASE_NAME --add-comments=/// \
-k_ -kQ_ -kC_ -kN_ -kNC_ -kg_dgettext -kg_dcgettext \
-kg_dngettext -kg_dpgettext -kg_dpgettext2 -kg_strip_context -F -n -o \
$PRJ_PATH/$PO_DIR_NAME/$source.pot $C_FILELIST
@@ -28,21 +27,21 @@ xgettext --language=C --escape --package-name=$PROJECT_LOWERCASE_NAME_ABI --defa
find ${PRJ_PATH} -type f -regex '.*\.\(glade\|glade2\|ui\)\.h$' -exec rm '{}' \; 2>/dev/null
find ${PRJ_PATH} -type f -name '*.gschema.xml.h' -exec rm '{}' \; 2>/dev/null

msgcat -o $PRJ_PATH/$PO_DIR_NAME/$PROJECT_LOWERCASE_NAME_ABI.pot --use-first $PRJ_PATH/$PO_DIR_NAME/$source.pot
msgcat -o $PRJ_PATH/$PO_DIR_NAME/$PROJECT_LOWERCASE_NAME.pot --use-first $PRJ_PATH/$PO_DIR_NAME/$source.pot

rm $PRJ_PATH/$PO_DIR_NAME/$source.pot

[ 0 != $? ] && echo "xgettext failed ;-(" && exit 1
[ ! -e $PRJ_PATH/$PO_DIR_NAME/$PROJECT_LOWERCASE_NAME_ABI.pot ] && echo "No strings found ;-(" && exit 1
[ ! -e $PRJ_PATH/$PO_DIR_NAME/$PROJECT_LOWERCASE_NAME.pot ] && echo "No strings found ;-(" && exit 1

for d in $PRJ_PATH/$PO_DIR_NAME/*; do
[ ! -d $d ] && continue

if [ -e $d/$PROJECT_LOWERCASE_NAME_ABI.po ]; then
echo "Merging '${d##*/}' locale" && msgmerge -F -U $d/$PROJECT_LOWERCASE_NAME_ABI.po $PRJ_PATH/$PO_DIR_NAME/$PROJECT_LOWERCASE_NAME_ABI.pot
if [ -e $d/$PROJECT_LOWERCASE_NAME.po ]; then
echo "Merging '${d##*/}' locale" && msgmerge -F -U $d/$PROJECT_LOWERCASE_NAME.po $PRJ_PATH/$PO_DIR_NAME/$PROJECT_LOWERCASE_NAME.pot
[ 0 != $? ] && echo "msgmerge failed ;(" && exit 1
else
echo "Creating '${d##*/}' locale" && msginit -l ${d##*/} -o $d/$PROJECT_LOWERCASE_NAME_ABI.po -i $PRJ_PATH/$PO_DIR_NAME/$PROJECT_LOWERCASE_NAME_ABI.pot
echo "Creating '${d##*/}' locale" && msginit -l ${d##*/} -o $d/$PROJECT_LOWERCASE_NAME.po -i $PRJ_PATH/$PO_DIR_NAME/$PROJECT_LOWERCASE_NAME.pot
[ 0 != $? ] && echo "msginit failed ;(" && exit 1
fi



Loading…
Cancel
Save