Changeset 8880

Show
Ignore:
Timestamp:
02/18/10 15:54:51 (2 years ago)
Author:
mickecarlsson
Message:

Finally, an automated tool to generate all .pot files for localization, ugly but working. Requires some setup yet to be documented, should have merge from trunk but I did not manage that so here is another ci

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.7/update_i18n.sh

    r7346 r8880  
    2929  if [ -d ${modules}i18n ]; then 
    3030  echo "Found directory ${modules}i18n, creating temp file" 
    31   /var/lib/asterisk/bin/module_admin i18n ${modules%%/} > $modules${modules%%/}.i18n.php 
     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 
    3238  echo "Creating ${modules%%/}.pot file, extracting text strings" 
    33   find ${modules%%/}/*.php | xargs xgettext -L PHP -o ${modules%%/}/i18n/${modules%%/}.pot --keyword=_ - 
    34   echo "Removing temp file" 
     39  # Save the file as a temp file 
     40  find ${modules%%/}/*.php | xargs xgettext -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 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  echo "Removing temp files" 
    3564  rm $modules${modules%%/}.i18n.php 
     65  rm ${modules%%/}/i18n/${modules%%/}.tmp 
    3666  fi 
    3767done