]> git.p6c8.net - jirafeau_mojo42.git/blob - update-po.sh
b8d36e80848432ea00c33d074ee8ff25d4b2b127
[jirafeau_mojo42.git] / update-po.sh
1 #!/bin/sh
2 #
3 # Jyraphe, your web file repository
4 # Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as
8 # published by the Free Software Foundation, either version 3 of the
9 # License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
15 #
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 WD="`dirname $0`"
21
22 PACKAGE=Jyraphe
23 POTFILES=`ls ${WD}/pub/*.php ${WD}/pub/lib/*.php ${WD}/pub/lib/template/*.php`
24 POT="${WD}/l10n/${PACKAGE}.pot"
25
26 xgettext --language=PHP --output "${WD}/${PACKAGE}.po" ${POTFILES}
27
28 if cmp -s "${WD}/${PACKAGE}.po" "${POT}"
29 then
30 rm -f "${WD}/${PACKAGE}.po"
31 else
32 mv -f "${WD}/${PACKAGE}.po" "${WD}/l10n/${PACKAGE}.pot"
33 fi
34
35 for PO in `ls ${WD}/l10n/po/*.po`
36 do
37 LANG=`basename "${PO}" | sed 's/.po//'`
38 if msgmerge "${PO}" "${POT}" > "${WD}/${LANG}.pot"
39 then
40 mv -f "${WD}/${LANG}.pot" "${PO}"
41 echo "msgmerge of ${LANG} succeeded"
42 else
43 echo "msgmerge of ${LANG} failed"
44 rm -f "${WD}/${LANG}.pot"
45 fi
46 done

patrick-canterino.de