root/modules/branches/bootstrap-2.9/update_i18n.sh

Revision 8957, 3.9 kB (checked in by mickecarlsson, 3 years ago)

Updated all .pot file with removed locations. Makes it easier to track small spelling errors in between releases, even if lines number changes in code

  • Property svn:executable set to *
Line 
1 #! /bin/sh
2 # Copyright (c) 2008, 2010 Mikael Carlsson
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # The purpose of this script is to extract all text strings from all FreePBX code that can
14 # be translated and create template files under each modules/<module>/i18n directory.
15 # This script is intended to run in the checked out svn modules directory.
16 #
17
18 echo "Creating new POT template files for modules"
19 for modules in $(ls -d */);
20 do
21   echo "Checking if module ${modules%%/} has an i18n directory"
22   # spit out the module.xml in a <modulename>.i18.php so that we can grab it with the find
23   if [ -d ${modules}i18n ]; then
24   echo "Found directory ${modules}i18n, creating temp file"
25   # This is needed for localization to actually pickup the enclosed text strings
26   # This could probably be done better, but I lack the time for doing that so here it is
27   echo -e "<?php \nif (false) {" > $modules${modules%%/}.i18n.php
28   /var/lib/asterisk/bin/module_admin i18n ${modules%%/} >> $modules${modules%%/}.i18n.php
29   # This is needed for localization to actually pickup the enclosed text strings
30   # This could probably be done better, but I lack the time for doing that so here it is
31   echo -e "}\n?>\n" >> $modules${modules%%/}.i18n.php
32   echo "Creating ${modules%%/}.pot file, extracting text strings"
33   # Save the file as a temp file
34   find ${modules%%/}/*.php | xargs xgettext --no-location -L PHP -o ${modules%%/}/i18n/${modules%%/}.tmp --keyword=_ -
35   # Now add the copyright and the license info to the.pot file
36   # Again, could be done better, but I lack the time and really need this out now
37   echo "# This file is part of FreePBX." > ${modules%%/}/i18n/${modules%%/}.pot
38   echo "#" >> ${modules%%/}/i18n/${modules%%/}.pot
39   echo "#    FreePBX is free software: you can redistribute it and/or modify" >> ${modules%%/}/i18n/${modules%%/}.pot
40   echo "#    it under the terms of the GNU General Public License as published by" >> ${modules%%/}/i18n/${modules%%/}.pot
41   echo "#    the Free Software Foundation, either version 2 of the License, or" >> ${modules%%/}/i18n/${modules%%/}.pot
42   echo "#    (at your option) any later version." >> ${modules%%/}/i18n/${modules%%/}.pot
43   echo "#" >> ${modules%%/}/i18n/${modules%%/}.pot
44   echo "#    FreePBX is distributed in the hope that it will be useful," >> ${modules%%/}/i18n/${modules%%/}.pot
45   echo "#    but WITHOUT ANY WARRANTY; without even the implied warranty of" >> ${modules%%/}/i18n/${modules%%/}.pot
46   echo "#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" >> ${modules%%/}/i18n/${modules%%/}.pot
47   echo "#    GNU General Public License for more details." >> ${modules%%/}/i18n/${modules%%/}.pot
48   echo "#" >> ${modules%%/}/i18n/${modules%%/}.pot
49   echo "#    You should have received a copy of the GNU General Public License" >> ${modules%%/}/i18n/${modules%%/}.pot
50   echo "#    along with FreePBX.  If not, see <http://www.gnu.org/licenses/>." >> ${modules%%/}/i18n/${modules%%/}.pot
51   echo "#" >> ${modules%%/}/i18n/${modules%%/}.pot
52   echo "# FreePBX language template for ${modules%%/}" >> ${modules%%/}/i18n/${modules%%/}.pot
53   echo "# Copyright (C) 2008, 2009, 2010 Bandwith.com" >> ${modules%%/}/i18n/${modules%%/}.pot
54   echo "#" >> ${modules%%/}/i18n/${modules%%/}.pot
55   # Remove the first six lines of the .tmp file and put it in the -pot file
56   /bin/sed '1,6d' ${modules%%/}/i18n/${modules%%/}.tmp >> ${modules%%/}/i18n/${modules%%/}.pot
57   echo "Removing temp files"
58   rm $modules${modules%%/}.i18n.php
59   rm ${modules%%/}/i18n/${modules%%/}.tmp
60   fi
61 done
62 echo "Done, now don't forget to commit your work!"
Note: See TracBrowser for help on using the browser.