Glade, GSchema and Gettext.

This commit is contained in:
Kolan Sh 2015-10-22 21:22:08 +03:00
parent aa78f6d42c
commit 4a53bfb279
1 changed files with 10 additions and 12 deletions

View File

@ -6,14 +6,15 @@
PO_DIR_NAME=po PO_DIR_NAME=po
EXE_PATH="`readlink -f $0`" EXE_PATH="`readlink -f $0`"
PRJ_PATH="${EXE_PATH%/*/*/*}" PRJ_PATH="${EXE_PATH%/*/*/*}"
C_FILELIST="`find ${PRJ_PATH}/src -type f -regex '.*\.\(c\|cxx\|cpp\|vala\)$'`"
#UI_FILELIST="`find ${PRJ_PATH}/ui -type f -regex '.*\.\(glade\)$'`"
SOURCE_POT=source.pot
GLADE_POT=glade.pot
## ##
# code # code
## ##
cd $PRJ_PATH
find */ -type f -regex '.*\.\(glade\|glade2\|ui\)$' -exec intltool-extract --type="gettext/glade" '{}' \; 2>/dev/null
find */ -type f -name '*.gschema.xml' -exec intltool-extract --type="gettext/gsettings" '{}' \; 2>/dev/null
C_FILELIST="`find */ -type f -regex '.*\.\(h\|hxx\|hpp\|c\|cxx\|cpp\|vala\)$' 2>/dev/null`"
PROJECT_LOWERCASE_NAME=`grep '\<SET *(PROJECT_LOWERCASE_NAME\>' "$PRJ_PATH"/CMakeLists.txt | sed 's~.*"\(.*\)".*~\1~'` 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~'` MAJOR=`grep '\<SET *(MAJOR\>' "$PRJ_PATH"/CMakeLists.txt | sed 's~.*\([0-9]\+\).*~\1~'`
PROJECT_LOWERCASE_NAME_ABI="$PROJECT_LOWERCASE_NAME-$MAJOR" PROJECT_LOWERCASE_NAME_ABI="$PROJECT_LOWERCASE_NAME-$MAJOR"
@ -21,17 +22,14 @@ PROJECT_LOWERCASE_NAME_ABI="$PROJECT_LOWERCASE_NAME-$MAJOR"
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_ABI --default-domain=$PROJECT_LOWERCASE_NAME_ABI --add-comments=/// \
-k_ -kQ_ -kC_ -kN_ -kNC_ -kg_dgettext -kg_dcgettext \ -k_ -kQ_ -kC_ -kN_ -kNC_ -kg_dgettext -kg_dcgettext \
-kg_dngettext -kg_dpgettext -kg_dpgettext2 -kg_strip_context -F -n -o \ -kg_dngettext -kg_dpgettext -kg_dpgettext2 -kg_strip_context -F -n -o \
$PRJ_PATH/$PO_DIR_NAME/$SOURCE_POT $C_FILELIST $PRJ_PATH/$PO_DIR_NAME/$source.pot $C_FILELIST
xgettext --language=C --escape --package-name=$PROJECT_LOWERCASE_NAME_ABI --default-domain=$PROJECT_LOWERCASE_NAME_ABI --add-comments=/// \ find ${PRJ_PATH} -type f -regex '.*\.\(glade\|glade2\|ui\)\.h$' -exec rm '{}' \; 2>/dev/null
-k_ -kQ_ -kC_ -kN_ -kNC_ -kg_dgettext -kg_dcgettext \ find ${PRJ_PATH} -type f -name '*.gschema.xml.h' -exec rm '{}' \; 2>/dev/null
-kg_dngettext -kg_dpgettext -kg_dpgettext2 -kg_strip_context -F -n -o \
$PRJ_PATH/$PO_DIR_NAME/$GLADE_POT $C_FILELIST
msgcat -o $PRJ_PATH/$PO_DIR_NAME/$PROJECT_LOWERCASE_NAME_ABI.pot --use-first $PRJ_PATH/$PO_DIR_NAME/$SOURCE_POT $PRJ_PATH/$PO_DIR_NAME/$GLADE_POT msgcat -o $PRJ_PATH/$PO_DIR_NAME/$PROJECT_LOWERCASE_NAME_ABI.pot --use-first $PRJ_PATH/$PO_DIR_NAME/$source.pot
rm $PRJ_PATH/$PO_DIR_NAME/$SOURCE_POT rm $PRJ_PATH/$PO_DIR_NAME/$source.pot
rm $PRJ_PATH/$PO_DIR_NAME/$GLADE_POT
[ 0 != $? ] && echo "xgettext failed ;-(" && exit 1 [ 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_ABI.pot ] && echo "No strings found ;-(" && exit 1