Your browser must have JavaScript enabled in order to view this page.
 >  >
 
Welcome Guest#217 Login/register    Go to Bottom
Go to Top

Source for file dptext.php

Documentation is available at dptext.php

  1. <?php
  2. /**
  3.  * Replacements for gettext and _ if gettext is not enabled in PHP
  4.  *
  5.  * DutchPIPE version 0.4; PHP version 5
  6.  *
  7.  * LICENSE: This source file is subject to version 1.0 of the DutchPIPE license.
  8.  * If you did not receive a copy of the DutchPIPE license, you can obtain one at
  9.  * http://dutchpipe.org/license/1_0.txt or by sending a note to
  10.  * license@dutchpipe.org, in which case you will be mailed a copy immediately.
  11.  *
  12.  * @package    DutchPIPE
  13.  * @subpackage lib
  14.  * @author     Lennert Stock <ls@dutchpipe.org>
  15.  * @copyright  2006, 2007 Lennert Stock
  16.  * @license    http://dutchpipe.org/license/1_0.txt  DutchPIPE License
  17.  * @version    Subversion: $Id: dptext.php 278 2007-08-19 22:52:25Z ls $
  18.  * @link       http://dutchpipe.org/manual/package/DutchPIPE
  19.  * @see        dpuniverse.php
  20.  */
  21.  
  22. if (!DPSERVER_GETTEXT_ENABLED || !function_exists('gettext')) {
  23.     /**
  24.      * Looks up an optionally formatted message in the current domain for
  25.      * translation
  26.      *
  27.      * All texts in the DutchPIPE source code should be passed through this
  28.      * function in English. This allows DutchPIPE to return translated strings
  29.      * for DutchPIPE sites in other languages.
  30.      *
  31.      * The message can be a plain string, or a formatted string according to
  32.      * the sprintf format, see http://www.php.net/sprintf. In the last case more
  33.      * arguments must be given to fill in values, as seen in the sprintf
  34.      * documentation.
  35.      *
  36.      * If gettext is enabled and the set language is not equal to language of
  37.      * the given string, a translated string will be returned if available in
  38.      * the translation table.
  39.      *
  40.      * @param      string    $message    the integer or string to check
  41.      * @param      mixed     $args,...   the integer or string to check
  42.      * @return     string    string produced according to format and language
  43.      */
  44.     function dp_text($message)
  45.     {
  46.         if (=== func_num_args()) {
  47.             return $message;
  48.         }
  49.         $args func_get_args();
  50.         $args array_slice($args1);
  51.         return vsprintf($message$args);
  52.     }
  53. else {
  54.     if (!isset($language)) {
  55.         /* :TODO: Check Windows/other *NIXes */
  56.         putenv('LANGUAGE=' DPSERVER_LOCALE_FULL);
  57.         putenv('LANG=' DPSERVER_LOCALE_FULL);
  58.         setlocale(LC_ALLDPSERVER_LOCALE_FULL);
  59.         bindTextDomain(DPSERVER_GETTEXT_DOMAIN,
  60.             DPSERVER_GETTEXT_LOCALE_PATH);
  61.         textDomain(DPSERVER_GETTEXT_DOMAIN);
  62.             DPSERVER_GETTEXT_ENCODING);
  63.     }
  64.  
  65.     /**
  66.      * @ignore
  67.      */
  68.     function dp_text($message)
  69.     {
  70.         if (=== func_num_args()) {
  71.             return gettext($message);
  72.         }
  73.  
  74.         $args func_get_args();
  75.         return vsprintf(gettext($message)array_slice($args1));
  76.     }
  77. }
  78. ?>

Documentation generated on Mon, 03 Sep 2007 22:20:41 +0200 by phpDocumentor 1.3.0RC6

Click me!
Guest#217
 
 
 
  Go to Top
 
 
Input Field OptionsClose Input Field Go to Top
 
Legal Notices | Copyright © 2006, 2007 Lennert Stock. All rights reserved. Last update: Mon Sep 03 2007, 21:50 CET.