root/freepbx/branches/2.10/update_i18n.sh

Revision 12167, 7.1 kB (checked in by p_lindheimer, 2 years ago)

Merged revisions 11124-11125,11128-11133,11135,11137,11145-11147,11149,11166,11168,11216,11228-11229,11240-11241,11243-11244,11255,11263-11264,11272,11278,11280,11282,11285,11291-11293,11300,11302,11321,11334,11339-11343,11352,11363-11364,11366,11368,11382-11384,11388-11390,11399,11405-11406,11421,11449,11453-11460,11462-11464,11471,11482,11485-11487,11493-11494,11498,11502,11504,11528,11530,11535,11543,11555,11558,11574-11576,11579,11581,11583,11585-11587,11589,11591-11592,11599,11622,11629,11631,11633,11637-11639,11641,11652,11662-11663,11666,11668,11671-11672,11675-11676,11704,11711,11714,11719,11721,11723,11725-11726,11732,11755,11760,11762-11764,11767,11769-11770,11772-11774,11796,11799-11800,11805,11807,11810,11812,11818,11822,11826,11828,11830,11841-11842,11853-11855,11891-11892,11900,11928,11931,11937-11940,11944,11954,11960,11968,11971-11974,11986-11987,12016,12021-12022,12024,12036-12037,12044-12046,12056,12061,12066,12068,12073,12076,12154-12156 via svnmerge from

Merged 2.9 branch to trunk.

  • Property svn:executable set to *
Line 
1 #! /bin/sh
2 # Copyright (c) 2008, 2011 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 #
14 # The purpose of this script is to extract all text strings from all FreePBX code that can
15 # be translated and create template files under each modules/<module>/i18n directory.
16 # For this script to work you need to so svn co for for branch and for modules and
17 # install this in the same tree so that the script can do all extraction at once.
18 #
19
20 echo "Creating new POT template files for modules"
21 # go down to modules directory
22 cd amp_conf/htdocs/admin/modules
23 for modules in $(ls -d */);
24 do
25         echo "Checking if module ${modules%%/} has an i18n directory"
26         # spit out the module.xml in a <modulename>.i18.php so that we can grab it with the find
27         # all modules from svn MUST be installed as module_admin reads from
28         # the installed modules NOT from the directory itself
29         if [ -d ${modules}i18n ]; then
30         echo "Found directory ${modules}i18n, creating temp file"
31         # This is needed for localization to actually pickup the enclosed text strings
32         # This could probably be done better, but I lack the time for doing that so here it is
33         echo -e "<?php \nif (false) {" > $modules${modules%%/}.i18n.php
34         /var/lib/asterisk/bin/module_admin i18n ${modules%%/} >> $modules${modules%%/}.i18n.php
35         # This is needed for localization to actually pickup the enclosed text strings
36         # This could probably be done better, but I lack the time for doing that so here it is
37         echo -e "}\n?>\n" >> $modules${modules%%/}.i18n.php
38         echo "Creating ${modules%%/}.pot file, extracting text strings"
39         # Save the file as a temp file
40         find ${modules%%/}/*.php | xargs xgettext --no-location -L PHP -o ${modules%%/}/i18n/${modules%%/}.tmp --keyword=_ -
41         # Now add the copyright and the license info to the.pot file
42         # Again, could be done better, but I lack the time and really need this out now
43         echo "# This file is part of FreePBX." > ${modules%%/}/i18n/${modules%%/}.pot
44         echo "#" >> ${modules%%/}/i18n/${modules%%/}.pot
45         echo "#    FreePBX is free software: you can redistribute it and/or modify" >> ${modules%%/}/i18n/${modules%%/}.pot
46         echo "#    it under the terms of the GNU General Public License as published by" >> ${modules%%/}/i18n/${modules%%/}.pot
47         echo "#    the Free Software Foundation, either version 2 of the License, or" >> ${modules%%/}/i18n/${modules%%/}.pot
48         echo "#    (at your option) any later version." >> ${modules%%/}/i18n/${modules%%/}.pot
49         echo "#" >> ${modules%%/}/i18n/${modules%%/}.pot
50         echo "#    FreePBX is distributed in the hope that it will be useful," >> ${modules%%/}/i18n/${modules%%/}.pot
51         echo "#    but WITHOUT ANY WARRANTY; without even the implied warranty of" >> ${modules%%/}/i18n/${modules%%/}.pot
52         echo "#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" >> ${modules%%/}/i18n/${modules%%/}.pot
53         echo "#    GNU General Public License for more details." >> ${modules%%/}/i18n/${modules%%/}.pot
54         echo "#" >> ${modules%%/}/i18n/${modules%%/}.pot
55         echo "#    You should have received a copy of the GNU General Public License" >> ${modules%%/}/i18n/${modules%%/}.pot
56         echo "#    along with FreePBX.  If not, see <http://www.gnu.org/licenses/>." >> ${modules%%/}/i18n/${modules%%/}.pot
57         echo "#" >> ${modules%%/}/i18n/${modules%%/}.pot
58         echo "# FreePBX language template for ${modules%%/}" >> ${modules%%/}/i18n/${modules%%/}.pot
59         echo "# Copyright (C) 2008, 2009, 2010, 2011 Bandwith.com" >> ${modules%%/}/i18n/${modules%%/}.pot
60         echo "#" >> ${modules%%/}/i18n/${modules%%/}.pot
61         # Remove the first six lines of the .tmp file and put it in the -pot file
62         /bin/sed '1,6d' ${modules%%/}/i18n/${modules%%/}.tmp >> ${modules%%/}/i18n/${modules%%/}.pot
63     # Now set Project to FreePBX and utf-8 as charset
64     /bin/sed -i 's/PACKAGE VERSION/FreePBX/g' ${modules%%/}/i18n/${modules%%/}.pot
65     /bin/sed -i 's/charset=CHARSET/charset=utf-8/g' ${modules%%/}/i18n/${modules%%/}.pot
66         echo "Removing temp files"
67         rm $modules${modules%%/}.i18n.php
68         rm ${modules%%/}/i18n/${modules%%/}.tmp
69         fi
70 done
71 # Go back two directory levels
72 cd ../..
73 echo "Creating new POT template files for core"
74 # spit out the module.xml for core and framework to amp.i18.php so that we can grab it with the find
75 echo -e "<?php \nif (false) {" >> admin/modules/core/core.i18n.php
76 /var/lib/asterisk/bin/module_admin i18n core >> admin/modules/core/core.i18n.php
77 /var/lib/asterisk/bin/module_admin i18n framework >> admin/modules/core/core.i18n.php
78 echo -e "}\n?>\n" >> admin/modules/core/core.i18n.php
79 find admin/*.php admin/cdr/*.php admin/common/*.php admin/libraries/*.php admin/helpers/*.php admin/views/*.php admin/modules/core/*.php -maxdepth 0 | xargs xgettext --no-location -L PHP -o admin/i18n/amp.tmp --keyword=_ -
80 echo "# This file is part of FreePBX." > admin/i18n/amp.pot
81 echo "#" >> admin/i18n/amp.pot
82 echo "#    FreePBX is free software: you can redistribute it and/or modify" >> admin/i18n/amp.pot
83 echo "#    it under the terms of the GNU General Public License as published by" >> admin/i18n/amp.pot
84 echo "#    the Free Software Foundation, either version 2 of the License, or" >> admin/i18n/amp.pot
85 echo "#    (at your option) any later version." >> admin/i18n/amp.pot
86 echo "#" >> admin/i18n/amp.pot
87 echo "#    FreePBX is distributed in the hope that it will be useful," >> admin/i18n/amp.pot
88 echo "#    but WITHOUT ANY WARRANTY; without even the implied warranty of" >> admin/i18n/amp.pot
89 echo "#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" >> admin/i18n/amp.pot
90 echo "#    GNU General Public License for more details." >> admin/i18n/amp.pot
91 echo "#" >> admin/i18n/amp.pot
92 echo "#    You should have received a copy of the GNU General Public License" >> admin/i18n/amp.pot
93 echo "#    along with FreePBX.  If not, see <http://www.gnu.org/licenses/>." >> admin/i18n/amp.pot
94 echo "#" >> admin/i18n/amp.pot
95 echo "# FreePBX language template for framework" >> admin/i18n/amp.pot
96 echo "# Copyright (C) 2008, 2009, 2010, 2011 Bandwith.com" >> admin/i18n/amp.pot
97 echo "#" >> admin/i18n/amp.pot
98 # remove the <modulename>.i18.php
99 rm admin/modules/core/core.i18n.php
100 # Remove the first six lines of the .tmp file and put it in the -pot file
101 /bin/sed '1,6d' admin/i18n/amp.tmp >> admin/i18n/amp.pot
102 # Now set Project to FreePBX and utf-8 as charset
103 /bin/sed -i 's/PACKAGE VERSION/FreePBX/g' admin/i18n/amp.pot
104 /bin/sed -i 's/charset=CHARSET/charset=utf-8/g' admin/i18n/amp.pot
105 echo "Removing temp files"
106 rm admin/i18n/amp.tmp
107 echo "Done, now don't forget to commit your work!"
Note: See TracBrowser for help on using the browser.