1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace KamiYang\ProjectVersion\Facade; |
5
|
|
|
|
6
|
|
|
/* |
7
|
|
|
* This file is part of the ProjectVersion project. |
8
|
|
|
* |
9
|
|
|
* It is free software: you can redistribute it and/or modify |
10
|
|
|
* it under the terms of the GNU General Public License as published by |
11
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
12
|
|
|
* (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* For the full copyright and license information, please read |
15
|
|
|
* LICENSE file that was distributed with this source code. |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
use TYPO3\CMS\Extbase\Utility\LocalizationUtility; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class LocalizationUtilityFacade |
22
|
|
|
* |
23
|
|
|
* Facade object for testing purposes of TYPO3\CMS\Extbase\Utility\LocalizationUtility. |
24
|
|
|
* |
25
|
|
|
* @see \TYPO3\CMS\Extbase\Utility\LocalizationUtility |
26
|
|
|
* @internal |
27
|
|
|
*/ |
28
|
|
|
class LocalizationUtilityFacade |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* Returns the localized label of the LOCAL_LANG key, $key. |
32
|
|
|
* |
33
|
|
|
* @param string $key The key from the LOCAL_LANG array for which to return the value. |
34
|
|
|
* @param string|null $extensionName The name of the extension |
35
|
|
|
* @param array $arguments The arguments of the extension, being passed over to vsprintf |
36
|
|
|
* @param string $languageKey The language key or null for using the current language from the system |
37
|
|
|
* @param string[] $alternativeLanguageKeys The alternative language keys if no translation was found. If null and we are in the frontend, then the language_alt from TypoScript setup will be used |
38
|
|
|
* @return string|null The value from LOCAL_LANG or null if no translation was found. |
39
|
|
|
*/ |
40
|
|
|
public function translate( |
41
|
|
|
$key, |
42
|
|
|
$extensionName = null, |
43
|
|
|
$arguments = null, |
44
|
|
|
string $languageKey = null, |
45
|
|
|
array $alternativeLanguageKeys = null |
46
|
|
|
) { |
47
|
|
|
return LocalizationUtility::translate($key, $extensionName, $arguments, $languageKey, $alternativeLanguageKeys); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|