Translated using Weblate (Arabic)
[phpmyadmin.git] / scripts / update-po
blob4c42eeafd0e34969b17abcab8632f90d5c44ae40
1 #!/bin/sh
2 # vim: expandtab sw=4 ts=4 sts=4:
3 export LC_ALL=C
5 # Do not run as CGI
6 if [ -n "$GATEWAY_INTERFACE" ] ; then
7 echo 'Can not invoke as CGI!'
8 exit 1
9 fi
11 # Exit on failure
12 set -e
14 # Generate Twig template cache in clean dir
15 rm -rf twig-templates/
16 php scripts/console cache:warmup --twig-po --env development
18 # Update pot (template), ensure that advisor is at the end
19 LOCS=`ls po/*.po | sed 's@.*/\(.*\)\.po@\1@'`
21 find . -name '*.php' -not -path './test/*' -not -path './po/*' -not -path './tmp/*' -not -path './release/*' -not -path './node_modules/*' -not -path './vendor/*' > twig-templates/filesList
23 php ./scripts/match-twig-cache
24 cat ./twig-templates/filesList | sort --dictionary-order --ignore-case --output ./twig-templates/filesList
25 php ./scripts/match-twig-cache --reverse
27 xgettext \
28 -d phpmyadmin \
29 --msgid-bugs-address=translators@phpmyadmin.net \
30 -o po/phpmyadmin.pot \
31 --language=PHP \
32 --add-comments=l10n \
33 --add-location \
34 --debug \
35 --from-code=utf-8 \
36 --keyword=__ --keyword=_gettext --keyword=_pgettext:1c,2 --keyword=_ngettext:1,2 \
37 --copyright-holder="phpMyAdmin devel team" \
38 `cat ./twig-templates/filesList`
40 # Fixup filenames for Twig templates
41 php scripts/console fix-po-twig
43 # Remote twig templates
44 rm -rf twig-templates/
46 # Keep in sync with create-release.sh
47 fetchReleaseFromFile() {
48 php -r "define('VERSION_SUFFIX', ''); require_once('libraries/classes/Version.php'); echo \PhpMyAdmin\Version::VERSION;"
51 ver="$(fetchReleaseFromFile)"
53 sed -i.~ '
54 s/SOME DESCRIPTIVE TITLE/phpMyAdmin translation/;
55 s/PACKAGE/phpMyAdmin/;
56 s/(C) YEAR/(C) 2003 - '`date +%Y`'/;
57 s/VERSION/'$ver'/;
58 ' po/phpmyadmin.pot
60 # Update po files (translations)
61 for loc in $LOCS ; do
62 sed -i.~ '
63 s/SOME DESCRIPTIVE TITLE/phpMyAdmin translation/;
64 s/PACKAGE/phpMyAdmin/;
65 s/(C) YEAR/(C) 2003 - '`date +%Y`'/;
66 s/VERSION/'$ver'/;
67 s/Project-Id-Version: phpMyAdmin .*/Project-Id-Version: phpMyAdmin '$ver'\\n"/;
68 ' po/$loc.po
69 msgmerge --previous -U po/$loc.po po/phpmyadmin.pot
70 done
72 # Commit changes
73 git add po/*.po po/phpmyadmin.pot
74 git commit -s -m 'Update po files
76 [ci skip]'