Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

eztranslatorgroup.php
Go to the documentation of this file.
1 <?php
18 class eZTranslatorGroup extends eZTranslatorHandler
19 {
20 public function __construct( $is_key_based )
21 {
22 parent::__construct( $is_key_based );
23 $this->Handlers = array();
24 }
25
32 function findKey( $key )
33 {
34 $num = $this->keyPick( $key );
35 if ( $num >=0 and $num <= count( $this->Handlers ) )
36 {
37 $handler = $this->Handlers[$num];
38 return $handler->findKey( $key );
39 }
40 $retValue = null;
41 return $retValue;
42 }
43
52 function findMessage( $context, $source, $comment = null )
53 {
54 $num = $this->pick( $context, $source, $comment );
55 if ( $num >=0 and $num <= count( $this->Handlers ) )
56 {
57 $handler = $this->Handlers[$num];
58 return $handler->findMessage( $context, $source, $comment );
59 }
60 $retValue = null;
61 return $retValue;
62 }
63
70 function translate( $context, $source, $comment = null )
71 {
72 $num = $this->pick( $context, $source, $comment );
73 if ( $num >=0 and $num <= count( $this->Handlers ) )
74 {
75 $handler = $this->Handlers[$num];
76 return $handler->translate( $context, $source, $comment );
77 }
78
79 return null;
80 }
81
88 function keyTranslate( $key )
89 {
90 $num = $this->keyPick( $key );
91 if ( $num >=0 and $num <= count( $this->Handlers ) )
92 {
93 $handler = $this->Handlers[$num];
94 return $handler->keyTranslate( $key );
95 }
96
97 return null;
98 }
99
106 function keyPick( $key )
107 {
108 }
109
116 function pick( $context, $source, $comment )
117 {
118 }
119
123 function handlerCount()
124 {
125 return count( $this->Handlers );
126 }
127
131 function registerHandler( $handler )
132 {
133 if ( !$this->isKeyBased() and $handler->isKeyBased() )
134 {
135 eZDebug::writeError( "Cannot register keybased handler for non-keybased group", "eZTranslatorGroup" );
136 return false;
137 }
138 $this->Handlers[] = $handler;
139 return true;
140 }
141
144 public $Handlers;
145 }
146
147 ?>
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZTranslatorGroup
Allows for picking translator handlers according to context.
Definition: eztranslatorgroup.php:19
eZTranslatorGroup\handlerCount
handlerCount()
Definition: eztranslatorgroup.php:123
eZTranslatorGroup\keyPick
keyPick( $key)
Definition: eztranslatorgroup.php:106
eZTranslatorGroup\keyTranslate
keyTranslate( $key)
Definition: eztranslatorgroup.php:88
eZTranslatorGroup\findKey
findKey( $key)
Definition: eztranslatorgroup.php:32
eZTranslatorGroup\translate
translate( $context, $source, $comment=null)
Definition: eztranslatorgroup.php:70
eZTranslatorGroup\findMessage
findMessage( $context, $source, $comment=null)
Definition: eztranslatorgroup.php:52
eZTranslatorGroup\registerHandler
registerHandler( $handler)
Definition: eztranslatorgroup.php:131
eZTranslatorGroup\$Handlers
$Handlers
Definition: eztranslatorgroup.php:144
eZTranslatorGroup\pick
pick( $context, $source, $comment)
Definition: eztranslatorgroup.php:116
eZTranslatorGroup\__construct
__construct( $is_key_based)
Definition: eztranslatorgroup.php:20
eZTranslatorHandler
Base class for translation handling.
Definition: eztranslatorhandler.php:19
eZTranslatorHandler\isKeyBased
isKeyBased()
Definition: eztranslatorhandler.php:34
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.