Created
February 24, 2018 15:56
-
-
Save trappedinspacetime/ff1116e2abaac606120f25fad673d007 to your computer and use it in GitHub Desktop.
Translate vala project (including appdata.xml and .desktop files) with Gettext and bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script for easy developing by Carlos Suárez (bitseater@gmail.com) - 2018 | |
# Define variables | |
PACKAGE="myapplication" | |
TEMPLATE=po/$PACKAGE.pot | |
FILES=po/*.po | |
# Search strings to translate and update po files (mark with _ translatable fields in appdata file) | |
# p.ex.: <_li>My Application do something</_li><_li>Also do something more</_li> | |
# Don't use _ to <name> and <summary>. | |
MYVAR=$(find . -type f -name *vala -or -name *appdata.xml.in -or -name *desktop.in) | |
xgettext --keyword=_ --escape --sort-output -o $TEMPLATE $MYVAR | |
for f in $FILES | |
do | |
msgmerge -v $f $TEMPLATE --update | |
echo $f "updated." | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment