paul@1005 | 1 | #!/bin/sh |
paul@1005 | 2 | |
paul@1201 | 3 | # This tool extracts textual messages from the imip-agent program files, using |
paul@1201 | 4 | # the gettext software to merge updated messages with the existing catalogues. |
paul@1201 | 5 | # |
paul@1201 | 6 | # Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> |
paul@1201 | 7 | # |
paul@1201 | 8 | # This program is free software; you can redistribute it and/or modify it under |
paul@1201 | 9 | # the terms of the GNU General Public License as published by the Free Software |
paul@1201 | 10 | # Foundation; either version 3 of the License, or (at your option) any later |
paul@1201 | 11 | # version. |
paul@1201 | 12 | # |
paul@1201 | 13 | # This program is distributed in the hope that it will be useful, but WITHOUT |
paul@1201 | 14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@1201 | 15 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@1201 | 16 | # details. |
paul@1201 | 17 | # |
paul@1201 | 18 | # You should have received a copy of the GNU General Public License along with |
paul@1201 | 19 | # this program. If not, see <http://www.gnu.org/licenses/>. |
paul@1201 | 20 | |
paul@1008 | 21 | # Obtain messages from the Python files. |
paul@1008 | 22 | |
paul@1008 | 23 | find imiptools imipweb -type f -name '*.py' \ |
paul@1008 | 24 | | xargs xgettext -d imip-agent --sort-by-file \ |
paul@1008 | 25 | --copyright-holder="Paul Boddie <paul@boddie.org.uk>" \ |
paul@1008 | 26 | --package-name="imip-agent" --package-version=`hg id | cut -d ' ' -f 1` |
paul@1008 | 27 | |
paul@1008 | 28 | # Set the default charset. |
paul@1005 | 29 | |
paul@1118 | 30 | sed "s/CHARSET/UTF-8/" imip-agent.po \ |
paul@1005 | 31 | > imip-agent.pot |
paul@1005 | 32 | |
paul@1008 | 33 | # Remove the original file. |
paul@1008 | 34 | |
paul@1008 | 35 | rm imip-agent.po |
paul@1008 | 36 | |
paul@1008 | 37 | # Merge messages with the existing translations. |
paul@1008 | 38 | |
paul@1005 | 39 | for FILENAME in messages/*.po ; do |
paul@1005 | 40 | msgmerge --update "$FILENAME" imip-agent.pot |
paul@1005 | 41 | done |