update translation scripts to include metainfo

--update translation scripts to include translatable
metadata for the appstream file. new dependencies for
the scripts are:
 - xmlstarlet
 - itstool

--added also greek translation for the appstream file
pull/1/head
Michail Vourlakos 8 years ago
parent cb5e7a8307
commit 87e1d1cd2f

@ -1,36 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<component type="desktop">
<id>org.kde.latte-dock.desktop</id>
<name>Latte</name>
<summary>Dock for the masses</summary>
<description>
<p>Latte is a dock based on plasma frameworks that provides an elegant and intuitive experience for your tasks and plasmoids. It animates its contents by using parabolic zoom effect and trys to be there only when it is needed.</p>
<p> "Art In Coffee" </p>
</description>
<categories>
<category>Utility</category>
<category>KDE</category>
</categories>
<url type="homepage">@WEBSITE@</url>
<url type="bugtracker">@BUG_ADDRESS@</url>
<url type="faq">@FAQS@</url>
<developer_name>@AUTHOR@</developer_name>
<icon type="stock">latte-dock</icon>
<project_license>GPL v2+</project_license>
<metadata_license>CC0-1.0</metadata_license>
<screenshots>
<screenshot type="default">
<image type="source">http://i.imgur.com/LLoXdgK.png</image>
</screenshot>
<screenshot>
<image type="source">https://2.bp.blogspot.com/-_gEFl6vIQt8/WNf3LaHcpvI/AAAAAAAAASk/CRZCF1vD2k0MQCesQk8CheBm5QrFRqYdQCLcB/s640/blur2.png</image>
</screenshot>
<screenshot>
<image type="source">http://i.imgur.com/CHCZ51A.png</image>
</screenshot>
<screenshot>
<image type="source">https://3.bp.blogspot.com/-4u-K09Tu8xI/WNf3LifOFxI/AAAAAAAAASo/AKh2HcenWpovNoJM8Yy65_jZUoXfhEi_QCLcB/s400/configwin.png</image>
</screenshot>
<id>org.kde.latte-dock.desktop</id>
<name>Latte</name>
<name xml:lang="el">Latte</name>
<summary>Dock for the masses</summary>
<summary xml:lang="el">Πίνακας εφαρμογών για όλον τον κόσμο</summary>
<description>
<p>Latte is a dock based on plasma frameworks that provides an elegant and intuitive experience for your tasks and plasmoids. It animates its contents by using parabolic zoom effect and trys to be there only when it is needed.</p>
<p xml:lang="el">Το Latte είναι ένας πίνακας εφαρμογών βασισμένος στα plasma frameworks που εστιάζει στην καλαισθησία και παρέχει ένα όμορφο περιβάλλον για τις εργασίες και τα γραφικά συστατικά σας. Χρησιμοποιεί ένα παραβολικό εφέ έτσι ώστε να απεικονίσει τα περιεχόμενα του και προσπαθεί να είναι εκεί μόνο όταν το χρειάζεστε.</p>
<p> "Art In Coffee" </p>
<p xml:lang="el">"Τέχνη στον Καφέ"</p>
</description>
<categories>
<category>Utility</category>
<category>KDE</category>
</categories>
<url type="homepage">@WEBSITE@</url>
<url type="bugtracker">@BUG_ADDRESS@</url>
<url type="faq">@FAQS@</url>
<developer_name>@AUTHOR@</developer_name>
<icon type="stock">latte-dock</icon>
<project_license>GPL v2+</project_license>
<metadata_license>CC0-1.0</metadata_license>
<screenshots>
<screenshot type="default">
<image type="source">http://i.imgur.com/LLoXdgK.png</image>
</screenshot>
<screenshot>
<image type="source">https://2.bp.blogspot.com/-_gEFl6vIQt8/WNf3LaHcpvI/AAAAAAAAASk/CRZCF1vD2k0MQCesQk8CheBm5QrFRqYdQCLcB/s640/blur2.png</image>
</screenshot>
<screenshot>
<image type="source">http://i.imgur.com/CHCZ51A.png</image>
</screenshot>
<screenshot>
<image type="source">https://3.bp.blogspot.com/-4u-K09Tu8xI/WNf3LifOFxI/AAAAAAAAASo/AKh2HcenWpovNoJM8Yy65_jZUoXfhEi_QCLcB/s400/configwin.png</image>
</screenshot>
</screenshots>
<project_group>KDE</project_group>
<provides>
@ -38,9 +42,8 @@
<library>liblattedockplugin.so</library>
</provides>
<releases>
<release version="0.6.0" date="2017-04-02" />
<release version="0.6.1" date="2017-05-05" />
<release version="0.6.2" date="2017-05-09" />
</releases>
<release version="0.6.0" date="2017-04-02"/>
<release version="0.6.1" date="2017-05-05"/>
<release version="0.6.2" date="2017-05-09"/>
</releases>
</component>

@ -92,6 +92,10 @@ ki18n_xgettext app "$PROJECTAPP" "$TEMPLATEAPP" shell
# The msg of shell package is merged with app
# ki18n_xgettext shell "$PROJECTSHELL" "$TEMPLATESHELL"
# extract appstream metainfo strings
cd "$BASEDIR/scripts"
bash ./extract_metainfo.sh
cd "$BASEDIR"
bash ./update-metadata.sh

@ -0,0 +1,43 @@
# Michail Vοurlakos <mvourlakos@gmail.com>, 2017.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2017-05-13 19:33+0300\n"
"PO-Revision-Date: 2017-05-13 19:36+0200\n"
"Last-Translator: Michail Vοurlakos <mvourlakos@gmail.com>\n"
"Language-Team: Greek <kde-i18n-doc@kde.org>\n"
"Language: el\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Lokalize 2.0\n"
#. (itstool) path: component/name
#: org.kde.latte-dock.appdata.xml.cmake:4
msgid "Latte"
msgstr "Latte"
#. (itstool) path: component/summary
#: org.kde.latte-dock.appdata.xml.cmake:5
msgid "Dock for the masses"
msgstr "Πίνακας εφαρμογών για όλον τον κόσμο"
#. (itstool) path: description/p
#: org.kde.latte-dock.appdata.xml.cmake:7
msgid ""
"Latte is a dock based on plasma frameworks that provides an elegant and "
"intuitive experience for your tasks and plasmoids. It animates its contents "
"by using parabolic zoom effect and trys to be there only when it is needed."
msgstr ""
"Το Latte είναι ένας πίνακας εφαρμογών βασισμένος στα plasma frameworks που "
"εστιάζει στην καλαισθησία και παρέχει ένα όμορφο περιβάλλον για τις εργασίες "
"και τα γραφικά συστατικά σας. Χρησιμοποιεί ένα παραβολικό εφέ έτσι ώστε να "
"απεικονίσει τα περιεχόμενα του και προσπαθεί να είναι εκεί μόνο όταν το "
"χρειάζεστε."
#. (itstool) path: description/p
#: org.kde.latte-dock.appdata.xml.cmake:8
msgid "\"Art In Coffee\""
msgstr "\"Τέχνη στον Καφέ\""

@ -0,0 +1,31 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2017-05-13 19:36+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. (itstool) path: component/name
#: org.kde.latte-dock.appdata.xml.cmake:4
msgid "Latte"
msgstr ""
#. (itstool) path: component/summary
#: org.kde.latte-dock.appdata.xml.cmake:5
msgid "Dock for the masses"
msgstr ""
#. (itstool) path: description/p
#: org.kde.latte-dock.appdata.xml.cmake:7
msgid "Latte is a dock based on plasma frameworks that provides an elegant and intuitive experience for your tasks and plasmoids. It animates its contents by using parabolic zoom effect and trys to be there only when it is needed."
msgstr ""
#. (itstool) path: description/p
#: org.kde.latte-dock.appdata.xml.cmake:8
msgid "\"Art In Coffee\""
msgstr ""

@ -0,0 +1,8 @@
<its:rules
xmlns:its="http://www.w3.org/2005/11/its"
version="1.0">
<its:translateRule translate="no" selector="/component"/>
<its:translateRule translate="yes"
selector="/component/name | /component/summary |
/component/description | /component/screenshots/screenshot/caption"/>
</its:rules>

@ -0,0 +1,39 @@
#!/bin/bash
#l10nscripts=`dirname $0`
ASMETAINFOITS="as-metainfo.its"
podir="../metainfo"
metainfo_file="../../app/org.kde.latte-dock.appdata.xml.cmake"
# first, strip translation from project metadata file
tmpxmlfile=$(mktemp)
xmlstarlet ed -d "//*[@xml:lang]" $metainfo_file > $tmpxmlfile
# get rid of the .xml extension and dirname
metainfo_file_basename=$(basename $metainfo_file)
dataname="${metainfo_file_basename%.xml*}"
# create pot file foo.[appdata|metadata].xml -> foo.[appdata|metadata].pot
itstool -i $ASMETAINFOITS -o $podir/$dataname.pot $tmpxmlfile
esc_tmpxmlfile=$(echo $tmpxmlfile|sed -e 's/[]\/()$*.^|[]/\\&/g')
sed -i "/^#:/s/$esc_tmpxmlfile/$metainfo_file_basename/" $podir/$dataname.pot
tmpmofiles=""
tmpdir=$(mktemp -d)
echo -e "-- Update translation strings for .po files in metainfo"
# find po files
catalogs=$(find "${podir}" -name '*.po')
for pofile in $catalogs; do
# get language-id
echo "${pofile}"
msgmerge -o "${pofile}.new" "${pofile}" "$podir/$dataname.pot"
mv "${pofile}.new" "${pofile}"
done
echo -e "-- Done updating translation strings for .po files in metainfo"
# cleanup
rm -rf $tmpdir
rm $tmpxmlfile

@ -0,0 +1,47 @@
#!/bin/bash
#l10nscripts=`dirname $0`
ASMETAINFOITS="as-metainfo.its"
podir="../metainfo"
metainfo_file="../../app/org.kde.latte-dock.appdata.xml.cmake"
# first, strip translation from project metadata file
tmpxmlfile=$(mktemp)
xmlstarlet ed -d "//*[@xml:lang]" $metainfo_file > $tmpxmlfile
# get rid of the .xml extension and dirname
metainfo_file_basename=$(basename $metainfo_file)
dataname="${metainfo_file_basename%.xml*}"
# create pot file foo.[appdata|metadata].xml -> foo.[appdata|metadata].pot
itstool -i $ASMETAINFOITS -o $podir/$dataname.pot $tmpxmlfile
esc_tmpxmlfile=$(echo $tmpxmlfile|sed -e 's/[]\/()$*.^|[]/\\&/g')
sed -i "/^#:/s/$esc_tmpxmlfile/$metainfo_file_basename/" $podir/$dataname.pot
tmpmofiles=""
tmpdir=$(mktemp -d)
# find po files
catalogs=$(find "${podir}" -name '*.po')
for pofile in $catalogs; do
# get language-id
lang=$(echo $(basename $pofile)|cut -d/ -f2)
# generate mo files (need to be named after their language)
mofile="$tmpdir/$lang.mo"
msgfmt $pofile -o $mofile
tmpmofiles="$tmpmofiles $mofile"
done
if [ -n "$tmpmofiles" ]; then
# recreate file, using the untranslated temporary data and the translation
itstool -i $ASMETAINFOITS -j $tmpxmlfile -o $metainfo_file $tmpmofiles
echo -e "$metainfo_file_basename file for \e[0;32mappstream\e[0m was updated..."
fi
# cleanup
rm -rf $tmpdir
rm $tmpxmlfile

@ -35,3 +35,7 @@ generate_desktop_file shell shell.metadata.desktop.template "$PROJECTSHELL"
generate_desktop_file app org.kde.latte-dock.desktop.template "$PROJECTAPP"
generate_desktop_file app lattedock.notifyrc.template "$NOTIFYRC"
#update the appstream metadata file
cd "$BASEDIR/scripts"
bash ./update_metainfo.sh

Loading…
Cancel
Save