edited script

This commit is contained in:
arcan1s 2014-06-05 19:30:23 +04:00
parent d573cc7491
commit 7e2b1384ae
2 changed files with 19 additions and 72 deletions

View File

@ -1,15 +0,0 @@
#!/bin/sh
WDIR=`pwd` # working dir
SATELLITE_LIST=satellite.list
BACKGROUND_LIST=background.list
# Background list
cd "$WDIR"
cd ../images
ls -1 background_* | sed -e "s/background_//g" | sed -e "s/_/ /g" | sed -e "s/\.jpg//g" | sed -e "s/\.png//g" | sed -e "s/\.gif//g" | grep -v '^$' | sort --unique --ignore-leading-blanks > "$WDIR/background.list"
# Satellite list
cd "$WDIR"
cd ../data
cat satellite_images.xml | grep image\ name | sed -e "s/.*<image name=\"\([^\"]*\).*/\1/" | sed -e "s/\&amp;/\&/g" | sed -e "s/\&apos;/'/g" | sed -e "s/\&quot;/\"/g" | sed -e "s/\&lt;/</g" | sed -e "s/\&gt;/>/g" | grep -v '^$' | sort --unique --ignore-leading-blanks > "$WDIR/satellite.list"

View File

@ -2,80 +2,42 @@
BASEDIR="../contents" # root of translatable sources BASEDIR="../contents" # root of translatable sources
PROJECT="pytextmonitor" # project name PROJECT="pytextmonitor" # project name
BUGADDR="http://kde-look.org/content/show.php?content=157124" # MSGID-Bugs BUGADDR="http://kde-look.org/content/show.php?content=157124" # MSGID-Bugs
WDIR=`pwd` # working dir WDIR=$(pwd) # working dir
SATELLITE_LIST=satellite.list SATELLITE_LIST=satellite.list
BACKGROUND_LIST=background.list BACKGROUND_LIST=background.list
add_list()
{
LIST=$1
if [ -z "$LIST" ]
then
echo ">>ERR<< add_list() - missing parameter LIST - exiting"
return
fi
if [ -f "$LIST" ]
then
cat $LIST | while read ROW
do
echo "tr2i18n(\"${ROW}\")" >> ${WDIR}/rc.cpp
done
else
echo ">>ERR<< add_list() - file $LIST does not exist."
fi
}
echo "Preparing rc files" echo "Preparing rc files"
cd ${BASEDIR} cd "${BASEDIR}"
# we use simple sorting to make sure the lines do not jump around too much from system to system find . -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' -o -name '*.py' | sort > "${WDIR}/rcfiles.list"
find . -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' -o -name '*.py' | sort > ${WDIR}/rcfiles.list xargs --arg-file=${WDIR}/rcfiles.list extractrc > "${WDIR}/rc.cpp"
xargs --arg-file=${WDIR}/rcfiles.list extractrc > ${WDIR}/rc.cpp echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> "${WDIR}/rc.cpp"
echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> "${WDIR}/rc.cpp"
# additional string for KAboutData
echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> ${WDIR}/rc.cpp
echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> ${WDIR}/rc.cpp
cd ${WDIR}
# Add Satellite list
add_list "$SATELLITE_LIST"
# Add Background list
add_list "$BACKGROUND_LIST"
echo "Done preparing rc files" echo "Done preparing rc files"
echo "Extracting messages" echo "Extracting messages"
cd ${BASEDIR} cd "${WDIR}"
# see above on sorting cd "${BASEDIR}"
find . -name '*.cpp' -o -name '*.h' -o -name '*.c' -o -name '*.py' | sort > ${WDIR}/infiles.list find . -name '*.cpp' -o -name '*.h' -o -name '*.c' -o -name '*.py' | sort > "${WDIR}/infiles.list"
echo "rc.cpp" >> ${WDIR}/infiles.list echo "rc.cpp" >> "${WDIR}/infiles.list"
cd ${WDIR}
cd "${WDIR}"
xgettext --from-code=UTF-8 -C -kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 \ xgettext --from-code=UTF-8 -C -kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 \
-kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \ -kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \
--msgid-bugs-address="${BUGADDR}" --language=Python \ --msgid-bugs-address="${BUGADDR}" --language=Python \
--files-from=infiles.list -D ${BASEDIR} -D ${WDIR} -o ${PROJECT}.pot || { echo "error while calling xgettext. aborting."; exit 1; } --files-from=infiles.list -D "${BASEDIR}" -D "${WDIR}" -o "${PROJECT}.pot" || { echo "error while calling xgettext. aborting."; exit 1; }
echo "Done extracting messages" echo "Done extracting messages"
echo "Merging translations" echo "Merging translations"
catalogs=`find . -name '*.po'` catalogs=$(find . -name '*.po')
for cat in $catalogs; do for cat in $catalogs; do
echo $cat echo $cat
msgmerge -o $cat.new $cat ${PROJECT}.pot msgmerge -o "$cat.new" "$cat" "${PROJECT}.pot"
mv $cat.new $cat mv "$cat.new" "$cat"
done done
echo "Done merging translations" echo "Done merging translations"
echo "Cleaning up" echo "Cleaning up"
cd ${WDIR} cd "${WDIR}"
rm rcfiles.list rm -f rcfiles.list infiles.list rc.cpp
rm infiles.list
rm rc.cpp
echo "Done" echo "Done"