Commit 4672fea1 authored by Gabriele Musco's avatar Gabriele Musco
Browse files

updated update_potfiles script

parent 50fc96d1
Pipeline #114098 passed with stage
in 24 seconds
......@@ -3,7 +3,6 @@ data/org.gabmus.hydrapaper.desktop.in
data/ui/choose_folder_dialog.glade
data/ui/headerbar.glade
data/ui/menu.xml
data/ui/menu.xml data/ui/shortcutsWindow.xml
data/ui/wallpapers_flowbox.glade
data/ui/wallpapers_folders_view.glade
data/ui/which_wallpaper_box.glade
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-10 19:52+0200\n"
"POT-Creation-Date: 2019-09-11 20:48+0200\n"
"PO-Revision-Date: 2019-09-10 19:53+0200\n"
"Last-Translator: Gabriele Musco <emaildigabry@gmail.com>\n"
"Language-Team: Italian\n"
......
#!/bin/bash
APPNAME="hydrapaper"
if [ -z $1 ]; then
echo "Usage: $0 lang"
exit
fi
lang="$1"
rm *.pot
version=$(fgrep "version: " ../meson.build | grep -v "meson" | grep -o "'.*'" | sed "s/'//g")
find ../hydrapaper -iname "*.py" | xargs xgettext --package-name=HydraPaper --package-version=$version --from-code=UTF-8 --output=hydrapaper-python.pot
find ../data/ui -iname "*.glade" -or -iname "*.xml" | xargs xgettext --package-name=HydraPaper --package-version=$version --from-code=UTF-8 --output=hydrapaper-glade.pot -L Glade
find ../data/ -iname "*.desktop.in" | xargs xgettext --package-name=HydraPaper --package-version=$version --from-code=UTF-8 --output=hydrapaper-desktop.pot -L Desktop
find ../data/ -iname "*.appdata.xml.in" | xargs xgettext --no-wrap --package-name=HydraPaper --package-version=$version --from-code=UTF-8 --output=hydrapaper-appdata.pot
msgcat --use-first hydrapaper-python.pot hydrapaper-glade.pot hydrapaper-desktop.pot hydrapaper-appdata.pot > hydrapaper.pot
sed 's/#: //g;s/:[0-9]*//g;s/\.\.\///g' <(fgrep "#: " hydrapaper.pot) | sort | uniq > POTFILES.in
echo "# Please keep this list alphabetically sorted" > LINGUAS
for l in $(ls *.po); do basename $l .po >> LINGUAS; done
for lang in $(sed "s/^#.*$//g" LINGUAS); do
mv "${lang}.po" "${lang}.po.old"
msginit --locale=$lang --input hydrapaper.pot
find ../$APPNAME -iname "*.py" | xargs xgettext --package-name=$APPNAME --package-version=$version --from-code=UTF-8 --output=$APPNAME-python.pot
find ../data/ui -iname "*.glade" -or -iname "*.xml" | xargs xgettext --package-name=$APPNAME --package-version=$version --from-code=UTF-8 --output=$APPNAME-glade.pot -L Glade
find ../data/ -iname "*.desktop.in" | xargs xgettext --package-name=$APPNAME --package-version=$version --from-code=UTF-8 --output=$APPNAME-desktop.pot -L Desktop
find ../data/ -iname "*.appdata.xml.in" | xargs xgettext --no-wrap --package-name=$APPNAME --package-version=$version --from-code=UTF-8 --output=$APPNAME-appdata.pot
msgcat --use-first "$APPNAME-python.pot" "$APPNAME-glade.pot" "$APPNAME-desktop.pot" "$APPNAME-appdata.pot" > "$APPNAME.pot"
sed 's/#: //g;s/:[0-9]*//g;s/\.\.\///g' <(fgrep "#: " $APPNAME.pot) | sort | uniq | grep -v " " > POTFILES.in
[ -f "${lang}.po" ] && mv "${lang}.po" "${lang}.po.old"
msginit --locale=$lang --input "$APPNAME.pot"
if [ -f "${lang}.po.old" ]; then
mv "${lang}.po" "${lang}.po.new"
msgmerge -N "${lang}.po.old" "${lang}.po.new" > ${lang}.po
rm "${lang}.po.old" "${lang}.po.new"
done
rm *.pot
fi
# To create lang file use this command
# msginit --locale=LOCALE --input hydrapaper.pot
# where LOCALE is something like `de`, `it`, `es`...
rm *.pot
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