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 filepull/1/head
parent
cb5e7a8307
commit
87e1d1cd2f
@ -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
|
||||
|
Loading…
Reference in New Issue