]> git.agnieray.net Git - galette.git/blob - galette/lib/Galette/Core/Translator.php
Remove 'svn' lines
[galette.git] / galette / lib / Galette / Core / Translator.php
1 <?php
2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5 /**
6 * i18n handling
7 *
8 * PHP version 5
9 *
10 * Copyright © 2007-2018 The Galette Team
11 *
12 * This file is part of Galette (http://galette.tuxfamily.org).
13 *
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
26 *
27 * @category Core
28 * @package Galette
29 *
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2018 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
33 * @link http://galette.tuxfamily.org
34 */
35
36 namespace Galette\Core;
37
38 use Analog\Analog;
39 use Laminas\I18n\Translator\Translator as ZTranslator;
40
41 /**
42 * Zend translator override
43 *
44 * @category Core
45 * @name Translator
46 * @package Galette
47 * @author Johan Cwiklinski <johan@x-tnd.be>
48 * @copyright 2018 The Galette Team
49 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
50 * @link http://galette.tuxfamily.org
51 */
52
53 class Translator extends ZTranslator
54 {
55
56 /**
57 * Do a translation exist for string
58 *
59 * @param string $message String to check for
60 * @param string $textDomain Translation domain, defaults to "default"
61 * @param string $locale Locale, defaults to null
62 *
63 * @return boolean
64 */
65 public function translationExists($message, $textDomain = 'default', $locale = null)
66 {
67 $locale = ($locale ?: $this->getLocale());
68
69 if (!isset($this->messages[$textDomain][$locale])) {
70 $this->loadMessages($textDomain, $locale);
71 }
72
73 return isset($this->messages[$textDomain][$locale][$message]);
74 }
75 }