[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/i18n/src/translation/ -> lmbWACTDictionaryExtractor.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/i18n/src/translation/lmbSourceDictionaryExtractor.class.php');
  10  
  11  /**

  12   * class lmbWACTDictionaryExtractor.

  13   *

  14   * @package i18n

  15   * @version $Id: lmbWACTDictionaryExtractor.class.php 5945 2007-06-06 08:31:43Z pachanga $

  16   */
  17  class lmbWACTDictionaryExtractor extends lmbSourceDictionaryExtractor
  18  {
  19    function extract($code, &$dictionaries = array(), $response = null)
  20    {
  21      if(preg_match_all('~\{\$[\'"]([^\'"]+)[\'"]\|i18n(:[\'"]([^\'"]+)[\'"])?~', $code, $matches))
  22      {
  23        foreach($matches[1] as $index => $text)
  24        {
  25          $domain = $matches[3][$index] ? $matches[3][$index] : 'default';
  26  
  27          if($response)
  28            $response->write("WACT template: '$text'@$domain\n");
  29  
  30          if(!isset($dictionaries[$domain]))
  31          {
  32            $dictionary = new lmbI18NDictionary();
  33            $dictionaries[$domain] = $dictionary;
  34          }
  35          else
  36            $dictionary = $dictionaries[$domain];
  37  
  38          $dictionary->add($text);
  39        }
  40      }
  41    }
  42  }
  43  
  44  ?>


Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7