System.I18N
[ class tree: System.I18N ] [ index: System.I18N ] [ all elements ]

Source for file LTranslate.php

Documentation is available at LTranslate.php

  1. <?php
  2. /**
  3. * class file.
  4. *
  5. * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
  6. * @copyright 2005, diemeisterei GmbH. All rights reserved.
  7. * @author $Author: schmunk $
  8. * @version $Revision: 220 $ $Date: 2006-05-19 19:50:30 +0200 (Fr, 19 Mai 2006) $
  9. * @package Lithron
  10. * @subpackage WebControls
  11. */
  12.  
  13. /**
  14. * Extended TTranslate control, with uc_first
  15. *
  16. * @package System.I18N
  17. */
  18. class LTranslate extends TTranslate
  19. {
  20.  
  21. /**
  22. * Sets the ucfirst param
  23. */
  24. public function setUcfirst($value)
  25. {
  26. $this->setViewstate("Ucfirst", TPropertyValue :: ensureBoolean($value));
  27. }
  28.  
  29. /**
  30. * @return Wheter use uc_first with input string, default is false
  31. */
  32. public function getUcfirst()
  33. {
  34. return $this->getViewstate("Ucfirst", false);
  35. }
  36.  
  37. /**
  38. * Renders the control
  39. */
  40. public function render($writer)
  41. {
  42. $textWriter=new TTextWriter;
  43. $htmlWriter=new THtmlWriter($textWriter);
  44. $subs = array();
  45. foreach($this->getControls() as $control)
  46. {
  47. if($control instanceof TTranslateParameter)
  48. $subs['{'.$control->getKey().'}'] = $control->getParameter();
  49. elseif($control instanceof TControl)
  50. $control->render($htmlWriter);
  51. elseif(is_string($control))
  52. $textWriter->write($control);
  53. }
  54.  
  55. $text = $this->getText();
  56. if(strlen($text)==0)
  57. $text = $textWriter->flush();
  58. if($this->getTrim())
  59. $text = trim($text);
  60.  
  61. if ($this->getUcfirst())
  62. {
  63. $text = ucfirst($this->translateText($text, $subs));
  64. }
  65. else
  66. {
  67. $text = $this->translateText($text, $subs);
  68.  
  69. }
  70. $writer->write($text);
  71. }
  72. }
  73. ?>

Documentation generated on Tue, 20 Jun 2006 05:15:24 +0200 by phpDocumentor 1.3.0RC4