Initial commit
[TYPO3CMS/Extensions/roq_newsevent.git] / Classes / ViewHelpers / TranslateViewHelper.php
1 <?php
2
3 /**
4 * Copyright (c) 2012, ROQUIN B.V. (C), http://www.roquin.nl
5 *
6 * @author: J. de Groot <jochem@roquin.nl>
7 * @file: EventController.php
8 * @description: Translate view helper, extending the fluid translate viewhelper
9 */
10
11 class Tx_RoqNewsevent_ViewHelpers_TranslateViewHelper extends Tx_Fluid_ViewHelpers_TranslateViewHelper {
12
13 /**
14 * Translate a given key or use the tag body as default.
15 *
16 * @param string $key The locallang key
17 * @param string $default if the given locallang key could not be found, this value is used. . If this argument is not set, child nodes will be used to render the default
18 * @param boolean $htmlEscape TRUE if the result should be htmlescaped. This won't have an effect for the default value
19 * @param array $arguments Arguments to be replaced in the resulting string
20 * @return string The translated key or tag body if key doesn't exist
21 */
22 public function render($key, $default = NULL, $htmlEscape = TRUE, array $arguments = NULL) {
23 $value = parent::render($key, $default, $htmlEscape, $arguments);
24
25 if(!isset($value)) {
26 //$value = Tx_Extbase_Utility_Localization::translate($key, $GLOBALS['_EXTKEY'], $arguments);
27 $value = Tx_Extbase_Utility_Localization::translate($key, 'roq_newsevent', $arguments);
28 }
29
30 return $value;
31 }
32 }
33
34 ?>