‪TYPO3CMS  10.4
TranslationService.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\ServerRequestInterface;
34 
44 {
45 
51  protected ‪$LOCAL_LANG = [];
52 
61  protected ‪$LOCAL_LANG_UNSET = [];
62 
68  protected ‪$languageKey;
69 
76 
80  protected ‪$configurationManager;
81 
88  public static function ‪getInstance()
89  {
90  return GeneralUtility::makeInstance(ObjectManager::class)->get(self::class);
91  }
92 
104  public function ‪translate(
105  $key,
106  array $arguments = null,
107  string $locallangPathAndFilename = null,
108  string $language = null,
109  $defaultValue = ''
110  ) {
111  $value = null;
112  $key = (string)$key;
113 
114  if ($locallangPathAndFilename) {
115  $key = $locallangPathAndFilename . ':' . $key;
116  }
117 
118  $keyParts = explode(':', $key);
119  if (GeneralUtility::isFirstPartOfStr($key, 'LLL:')) {
120  $locallangPathAndFilename = $keyParts[1] . ':' . $keyParts[2];
121  $key = $keyParts[3];
122  } elseif (GeneralUtility::isFirstPartOfStr($key, 'EXT:')) {
123  $locallangPathAndFilename = $keyParts[0] . ':' . $keyParts[1];
124  $key = $keyParts[2];
125  } else {
126  if (count($keyParts) === 2) {
127  $locallangPathAndFilename = $keyParts[0];
128  $key = $keyParts[1];
129  }
130  }
131 
132  if ($language) {
133  $this->languageKey = $language;
134  }
135 
136  $this->‪initializeLocalization($locallangPathAndFilename ?? '');
137 
138  // The "from" charset of csConv() is only set for strings from TypoScript via _LOCAL_LANG
139  if (!empty($this->LOCAL_LANG[$this->languageKey][$key][0]['target'])
140  || isset($this->LOCAL_LANG_UNSET[$this->languageKey][$key])
141  ) {
142  // Local language translation for key exists
143  $value = $this->LOCAL_LANG[‪$this->languageKey][$key][0]['target'];
144  } elseif (!empty($this->alternativeLanguageKeys)) {
145  $languages = array_reverse($this->alternativeLanguageKeys);
146  foreach ($languages as $language) {
147  if (!empty($this->LOCAL_LANG[$language][$key][0]['target'])
148  || isset($this->LOCAL_LANG_UNSET[$language][$key])
149  ) {
150  // Alternative language translation for key exists
151  $value = $this->LOCAL_LANG[$language][$key][0]['target'];
152  break;
153  }
154  }
155  }
156 
157  if ($value === null && (!empty($this->LOCAL_LANG['default'][$key][0]['target'])
158  || isset($this->LOCAL_LANG_UNSET['default'][$key]))
159  ) {
160  // Default language translation for key exists
161  // No charset conversion because default is English and thereby ASCII
162  $value = $this->LOCAL_LANG['default'][$key][0]['target'];
163  }
164 
165  if (is_array($arguments) && !empty($arguments) && $value !== null) {
166  $value = vsprintf($value, $arguments);
167  } else {
168  if (empty($value)) {
169  $value = $defaultValue;
170  }
171  }
172 
173  return $value;
174  }
175 
184  public function ‪translateValuesRecursive(array $array, array $translationFiles = []): array
185  {
186  $result = $array;
187  foreach ($result as $key => $value) {
188  if (is_array($value)) {
189  $result[$key] = $this->‪translateValuesRecursive($value, $translationFiles);
190  } else {
191  $this->‪sortArrayWithIntegerKeysDescending($translationFiles);
192 
193  if (!empty($translationFiles)) {
194  foreach ($translationFiles as $translationFile) {
195  $translatedValue = $this->‪translate($value, null, $translationFile, null);
196  if (!empty($translatedValue)) {
197  $result[$key] = $translatedValue;
198  break;
199  }
200  }
201  } else {
202  $result[$key] = $this->‪translate($value, null, null, null, $value);
203  }
204  }
205  }
206  return $result;
207  }
208 
216  public function ‪translateToAllBackendLanguages(
217  string $key,
218  array $arguments = null,
219  array $translationFiles = []
220  ): array {
221  $result = [];
222  $translationFiles = $this->‪sortArrayWithIntegerKeysDescending($translationFiles);
223 
224  foreach ($this->‪getAllTypo3BackendLanguages() as $language) {
225  $result[$language] = $key;
226  foreach ($translationFiles as $translationFile) {
227  $translatedValue = $this->‪translate($key, $arguments, $translationFile, $language, $key);
228  if ($translatedValue !== $key) {
229  $result[$language] = $translatedValue;
230  break;
231  }
232  }
233  }
234 
235  return $result;
236  }
237 
247  public function ‪translateFinisherOption(
248  FormRuntime $formRuntime,
249  string $finisherIdentifier,
250  string $optionKey,
251  string $optionValue,
252  array $renderingOptions = []
253  ): string {
254  if (empty($finisherIdentifier)) {
255  throw new \InvalidArgumentException('The argument "finisherIdentifier" is empty', 1476216059);
256  }
257  if (empty($optionKey)) {
258  throw new \InvalidArgumentException('The argument "optionKey" is empty', 1476216060);
259  }
260 
261  $finisherIdentifier = preg_replace('/Finisher$/', '', $finisherIdentifier);
262  $translationFiles = $renderingOptions['translationFiles'] ?? [];
263  if (empty($translationFiles)) {
264  $translationFiles = $formRuntime->getRenderingOptions()['translation']['translationFiles'];
265  }
266 
267  $translationFiles = $this->‪sortArrayWithIntegerKeysDescending($translationFiles);
268 
269  if (isset($renderingOptions['translatePropertyValueIfEmpty'])) {
270  $translatePropertyValueIfEmpty = (bool)$renderingOptions['translatePropertyValueIfEmpty'];
271  } else {
272  $translatePropertyValueIfEmpty = true;
273  }
274 
275  if (empty($optionValue) && !$translatePropertyValueIfEmpty) {
276  return $optionValue;
277  }
278 
279  $language = null;
280  if (isset($renderingOptions['language'])) {
281  $language = $renderingOptions['language'];
282  }
283 
284  try {
285  $arguments = ‪ArrayUtility::getValueByPath($renderingOptions['arguments'] ?? [], $optionKey, '.');
286  } catch (MissingArrayPathException $e) {
287  $arguments = [];
288  }
289 
290  $originalFormIdentifier = null;
291  if (isset($formRuntime->getRenderingOptions()['_originalIdentifier'])) {
292  $originalFormIdentifier = $formRuntime->getRenderingOptions()['_originalIdentifier'];
293  }
294 
295  $translationKeyChain = [];
296  foreach ($translationFiles as $translationFile) {
297  if (!empty($originalFormIdentifier)) {
298  $translationKeyChain[] = sprintf('%s:%s.finisher.%s.%s', $translationFile, $originalFormIdentifier, $finisherIdentifier, $optionKey);
299  }
300  $translationKeyChain[] = sprintf('%s:%s.finisher.%s.%s', $translationFile, $formRuntime->getIdentifier(), $finisherIdentifier, $optionKey);
301  $translationKeyChain[] = sprintf('%s:finisher.%s.%s', $translationFile, $finisherIdentifier, $optionKey);
302  }
303 
304  $translatedValue = $this->‪processTranslationChain($translationKeyChain, $language, $arguments);
305  $translatedValue = empty($translatedValue) ? $optionValue : $translatedValue;
306 
307  return $translatedValue;
308  }
309 
318  public function ‪translateFormElementValue(
319  RootRenderableInterface $element,
320  array $propertyParts,
321  FormRuntime $formRuntime
322  ) {
323  if (empty($propertyParts)) {
324  throw new \InvalidArgumentException('The argument "propertyParts" is empty', 1476216007);
325  }
326 
327  $propertyType = 'properties';
328  $property = implode('.', $propertyParts);
329  $renderingOptions = $element->getRenderingOptions();
330 
331  if ($property === 'label') {
332  $defaultValue = $element->getLabel();
333  } else {
334  if ($element instanceof FormElementInterface) {
335  try {
336  $defaultValue = ‪ArrayUtility::getValueByPath($element->getProperties(), $propertyParts, '.');
337  } catch (MissingArrayPathException $exception) {
338  $defaultValue = null;
339  }
340  } else {
341  $propertyType = 'renderingOptions';
342  try {
343  $defaultValue = ‪ArrayUtility::getValueByPath($renderingOptions, $propertyParts, '.');
344  } catch (MissingArrayPathException $exception) {
345  $defaultValue = null;
346  }
347  }
348  }
349 
350  if (isset($renderingOptions['translation']['translatePropertyValueIfEmpty'])) {
351  $translatePropertyValueIfEmpty = $renderingOptions['translation']['translatePropertyValueIfEmpty'];
352  } else {
353  $translatePropertyValueIfEmpty = true;
354  }
355 
356  if (empty($defaultValue) && !$translatePropertyValueIfEmpty) {
357  return $defaultValue;
358  }
359 
360  $defaultValue = empty($defaultValue) ? '' : $defaultValue;
361  $translationFiles = $renderingOptions['translation']['translationFiles'] ?? [];
362  if (empty($translationFiles)) {
363  $translationFiles = $formRuntime->getRenderingOptions()['translation']['translationFiles'];
364  }
365 
366  $translationFiles = $this->‪sortArrayWithIntegerKeysDescending($translationFiles);
367 
368  $language = null;
369  if (isset($renderingOptions['translation']['language'])) {
370  $language = $renderingOptions['translation']['language'];
371  }
372 
373  try {
374  $arguments = ‪ArrayUtility::getValueByPath($renderingOptions['translation']['arguments'] ?? [], $propertyParts, '.');
375  } catch (MissingArrayPathException $e) {
376  $arguments = [];
377  }
378 
379  $originalFormIdentifier = null;
380  if (isset($formRuntime->getRenderingOptions()['_originalIdentifier'])) {
381  $originalFormIdentifier = $formRuntime->getRenderingOptions()['_originalIdentifier'];
382  }
383 
384  if ($property === 'options' && is_array($defaultValue)) {
385  foreach ($defaultValue as $optionValue => &$optionLabel) {
386  $translationKeyChain = [];
387  foreach ($translationFiles as $translationFile) {
388  if (!empty($originalFormIdentifier)) {
389  if ($element instanceof FormRuntime) {
390  $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s.%s', $translationFile, $originalFormIdentifier, $originalFormIdentifier, $propertyType, $property, $optionValue);
391  $translationKeyChain[] = sprintf('%s:element.%s.%s.%s.%s', $translationFile, $originalFormIdentifier, $propertyType, $property, $optionValue);
392  } else {
393  $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s.%s', $translationFile, $originalFormIdentifier, $element->getIdentifier(), $propertyType, $property, $optionValue);
394  }
395  }
396  $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $propertyType, $property, $optionValue);
397  $translationKeyChain[] = sprintf('%s:element.%s.%s.%s.%s', $translationFile, $element->getIdentifier(), $propertyType, $property, $optionValue);
398  $translationKeyChain[] = sprintf('%s:element.%s.%s.%s.%s', $translationFile, $element->getType(), $propertyType, $property, $optionValue);
399  }
400 
401  $translatedValue = $this->‪processTranslationChain($translationKeyChain, $language, $arguments);
402  $optionLabel = empty($translatedValue) ? $optionLabel : $translatedValue;
403  }
404  $translatedValue = $defaultValue;
405  } elseif ($property === 'fluidAdditionalAttributes' && is_array($defaultValue)) {
406  foreach ($defaultValue as $propertyName => &$propertyValue) {
407  $translationKeyChain = [];
408  foreach ($translationFiles as $translationFile) {
409  if (!empty($originalFormIdentifier)) {
410  if ($element instanceof FormRuntime) {
411  $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $originalFormIdentifier, $originalFormIdentifier, $propertyType, $propertyName);
412  $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $originalFormIdentifier, $propertyType, $propertyName);
413  } else {
414  $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $originalFormIdentifier, $element->getIdentifier(), $propertyType, $propertyName);
415  }
416  }
417  $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $propertyType, $propertyName);
418  $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $element->getIdentifier(), $propertyType, $propertyName);
419  $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $element->getType(), $propertyType, $propertyName);
420  }
421 
422  $translatedValue = $this->‪processTranslationChain($translationKeyChain, $language, $arguments);
423  $propertyValue = empty($translatedValue) ? $propertyValue : $translatedValue;
424  }
425  $translatedValue = $defaultValue;
426  } else {
427  $translationKeyChain = [];
428  foreach ($translationFiles as $translationFile) {
429  if (!empty($originalFormIdentifier)) {
430  if ($element instanceof FormRuntime) {
431  $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $originalFormIdentifier, $originalFormIdentifier, $propertyType, $property);
432  $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $originalFormIdentifier, $propertyType, $property);
433  } else {
434  $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $originalFormIdentifier, $element->getIdentifier(), $propertyType, $property);
435  }
436  }
437  $translationKeyChain[] = sprintf('%s:%s.element.%s.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $propertyType, $property);
438  $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $element->getIdentifier(), $propertyType, $property);
439  $translationKeyChain[] = sprintf('%s:element.%s.%s.%s', $translationFile, $element->getType(), $propertyType, $property);
440  }
441 
442  $translatedValue = $this->‪processTranslationChain($translationKeyChain, $language, $arguments);
443  $translatedValue = empty($translatedValue) ? $defaultValue : $translatedValue;
444  }
445 
446  return $translatedValue;
447  }
448 
459  public function ‪translateFormElementError(
460  RootRenderableInterface $element,
461  int $code,
462  array $arguments,
463  string $defaultValue = '',
464  FormRuntime $formRuntime
465  ): string {
466  if (empty($code)) {
467  throw new \InvalidArgumentException('The argument "code" is empty', 1489272978);
468  }
469 
470  $validationErrors = $element->getProperties()['validationErrorMessages'] ?? null;
471  if (is_array($validationErrors)) {
472  foreach ($validationErrors as $validationError) {
473  if ((int)$validationError['code'] === $code) {
474  return sprintf($validationError['message'], ...$arguments);
475  }
476  }
477  }
478 
479  $renderingOptions = $element->getRenderingOptions();
480  $translationFiles = $renderingOptions['translation']['translationFiles'] ?? [];
481  if (empty($translationFiles)) {
482  $translationFiles = $formRuntime->getRenderingOptions()['translation']['translationFiles'];
483  }
484 
485  $translationFiles = $this->‪sortArrayWithIntegerKeysDescending($translationFiles);
486 
487  $language = null;
488  if (isset($renderingOptions['language'])) {
489  $language = $renderingOptions['language'];
490  }
491 
492  $originalFormIdentifier = null;
493  if (isset($formRuntime->getRenderingOptions()['_originalIdentifier'])) {
494  $originalFormIdentifier = $formRuntime->getRenderingOptions()['_originalIdentifier'];
495  }
496 
497  $translationKeyChain = [];
498  foreach ($translationFiles as $translationFile) {
499  if (!empty($originalFormIdentifier)) {
500  if ($element instanceof FormRuntime) {
501  $translationKeyChain[] = sprintf('%s:%s.validation.error.%s.%s', $translationFile, $originalFormIdentifier, $originalFormIdentifier, $code);
502  $translationKeyChain[] = sprintf('%s:validation.error.%s.%s', $translationFile, $originalFormIdentifier, $code);
503  } else {
504  $translationKeyChain[] = sprintf('%s:%s.validation.error.%s.%s', $translationFile, $originalFormIdentifier, $element->getIdentifier(), $code);
505  }
506  $translationKeyChain[] = sprintf('%s:%s.validation.error.%s', $translationFile, $originalFormIdentifier, $code);
507  }
508  $translationKeyChain[] = sprintf('%s:%s.validation.error.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $code);
509  $translationKeyChain[] = sprintf('%s:%s.validation.error.%s', $translationFile, $formRuntime->getIdentifier(), $code);
510  $translationKeyChain[] = sprintf('%s:validation.error.%s.%s', $translationFile, $element->getIdentifier(), $code);
511  $translationKeyChain[] = sprintf('%s:validation.error.%s', $translationFile, $code);
512  }
513 
514  $translatedValue = $this->‪processTranslationChain($translationKeyChain, $language, $arguments);
515  $translatedValue = empty($translatedValue) ? $defaultValue : $translatedValue;
516  return $translatedValue;
517  }
518 
523  public function ‪setLanguage(string ‪$languageKey)
524  {
525  $this->languageKey = ‪$languageKey;
526  }
527 
532  public function ‪getLanguage(): string
533  {
534  return ‪$this->languageKey;
535  }
536 
543  protected function ‪processTranslationChain(
544  array $translationKeyChain,
545  string $language = null,
546  array $arguments = null
547  ) {
548  $translatedValue = null;
549  foreach ($translationKeyChain as $translationKey) {
550  $translatedValue = $this->‪translate($translationKey, $arguments, null, $language);
551  if (!empty($translatedValue)) {
552  break;
553  }
554  }
555  return $translatedValue;
556  }
557 
561  protected function ‪initializeLocalization(string $locallangPathAndFilename)
562  {
563  if (empty($this->languageKey)) {
564  $this->‪setLanguageKeys();
565  }
566 
567  if (!empty($locallangPathAndFilename)) {
569  $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
570  $this->LOCAL_LANG = $languageFactory->getParsedData($locallangPathAndFilename, $this->languageKey);
571 
572  foreach ($this->alternativeLanguageKeys as $language) {
573  $tempLL = $languageFactory->getParsedData($locallangPathAndFilename, $language);
574  if ($this->languageKey !== 'default' && isset($tempLL[$language])) {
575  $this->LOCAL_LANG[$language] = $tempLL[$language];
576  }
577  }
578  }
579  $this->‪loadTypoScriptLabels();
580  }
581 
585  protected function ‪setLanguageKeys()
586  {
587  $this->languageKey = 'default';
588 
589  $this->alternativeLanguageKeys = [];
590  if (TYPO3_MODE === 'FE') {
591  $this->languageKey = $this->‪getCurrentSiteLanguage()->‪getTypo3Language();
592 
593  if ($this->languageKey !== 'default') {
595  ‪$locales = GeneralUtility::makeInstance(Locales::class);
596  if (in_array($this->languageKey, ‪$locales->getLocales(), true)) {
597  foreach (‪$locales->getLocaleDependencies($this->languageKey) as $language) {
598  $this->alternativeLanguageKeys[] = $language;
599  }
600  }
601  }
602  } elseif (!empty(‪$GLOBALS['BE_USER']->uc['lang'])) {
603  $this->languageKey = ‪$GLOBALS['BE_USER']->uc['lang'];
604  } elseif (!empty($this->‪getLanguageService()->lang)) {
605  $this->languageKey = $this->‪getLanguageService()->lang;
606  }
607  }
608 
614  protected function ‪loadTypoScriptLabels()
615  {
616  $frameworkConfiguration = $this->‪getConfigurationManager()
618 
619  if (!is_array($frameworkConfiguration['_LOCAL_LANG'] ?? null)) {
620  return;
621  }
622  $this->LOCAL_LANG_UNSET = [];
623  foreach ($frameworkConfiguration['_LOCAL_LANG'] as ‪$languageKey => $labels) {
624  if (!(is_array($labels) && isset($this->LOCAL_LANG[‪$languageKey]))) {
625  continue;
626  }
627  foreach ($labels as $labelKey => $labelValue) {
628  if (is_string($labelValue)) {
629  $this->LOCAL_LANG[‪$languageKey][$labelKey][0]['target'] = $labelValue;
630  if ($labelValue === '') {
631  $this->LOCAL_LANG_UNSET[‪$languageKey][$labelKey] = '';
632  }
633  } elseif (is_array($labelValue)) {
634  $labelValue = $this->‪flattenTypoScriptLabelArray($labelValue, $labelKey);
635  foreach ($labelValue as $key => $value) {
636  $this->LOCAL_LANG[‪$languageKey][$key][0]['target'] = $value;
637  if ($value === '') {
638  $this->LOCAL_LANG_UNSET[‪$languageKey][$key] = '';
639  }
640  }
641  }
642  }
643  }
644  }
645 
657  protected function ‪flattenTypoScriptLabelArray(array $labelValues, string $parentKey = ''): array
658  {
659  $result = [];
660  foreach ($labelValues as $key => $labelValue) {
661  if (!empty($parentKey)) {
662  $key = $parentKey . '.' . $key;
663  }
664  if (is_array($labelValue)) {
665  $labelValue = $this->‪flattenTypoScriptLabelArray($labelValue, $key);
666  $result = array_merge($result, $labelValue);
667  } else {
668  $result[$key] = $labelValue;
669  }
670  }
671  return $result;
672  }
673 
680  protected function ‪sortArrayWithIntegerKeysDescending(array $array)
681  {
682  if (count(array_filter(array_keys($array), 'is_string')) === 0) {
683  krsort($array);
684  }
685  return $array;
686  }
687 
693  protected function ‪getConfigurationManager(): ConfigurationManagerInterface
694  {
695  if ($this->configurationManager !== null) {
697  }
698 
699  $this->configurationManager = GeneralUtility::makeInstance(ObjectManager::class)
700  ->get(ConfigurationManagerInterface::class);
702  }
703 
709  protected function ‪getCurrentSiteLanguage(): ?SiteLanguage
710  {
711  if (‪$GLOBALS['TYPO3_REQUEST'] instanceof ServerRequestInterface) {
712  return ‪$GLOBALS['TYPO3_REQUEST']->getAttribute('language', null);
713  }
714  return null;
715  }
716 
720  protected function ‪getAllTypo3BackendLanguages(): array
721  {
722  $languages = array_merge(
723  ['default'],
724  array_values(‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lang']['availableLanguages'] ?? [])
725  );
726 
727  return $languages;
728  }
729 
733  protected function ‪getLanguageService(): ‪LanguageService
734  {
735  return ‪$GLOBALS['LANG'];
736  }
737 }
‪TYPO3\CMS\Form\Domain\Runtime\FormRuntime
Definition: FormRuntime.php:103
‪TYPO3\CMS\Form\Service\TranslationService\setLanguage
‪setLanguage(string $languageKey)
Definition: TranslationService.php:518
‪TYPO3\CMS\Form\Service\TranslationService\translateFormElementValue
‪string array translateFormElementValue(RootRenderableInterface $element, array $propertyParts, FormRuntime $formRuntime)
Definition: TranslationService.php:313
‪TYPO3\CMS\Form\Service\TranslationService\getInstance
‪static TranslationService getInstance()
Definition: TranslationService.php:83
‪TYPO3\CMS\Form\Domain\Runtime\FormRuntime\getRenderingOptions
‪array getRenderingOptions()
Definition: FormRuntime.php:1025
‪TYPO3\CMS\Form\Service\TranslationService\getAllTypo3BackendLanguages
‪array getAllTypo3BackendLanguages()
Definition: TranslationService.php:715
‪TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface\getLabel
‪string getLabel()
‪TYPO3\CMS\Form\Service\TranslationService
Definition: TranslationService.php:44
‪TYPO3\CMS\Form\Service\TranslationService\getConfigurationManager
‪ConfigurationManagerInterface getConfigurationManager()
Definition: TranslationService.php:688
‪TYPO3\CMS\Form\Service\TranslationService\setLanguageKeys
‪setLanguageKeys()
Definition: TranslationService.php:580
‪TYPO3\CMS\Core\Localization\LocalizationFactory
Definition: LocalizationFactory.php:28
‪TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException
Definition: MissingArrayPathException.php:28
‪TYPO3\CMS\Form\Service\TranslationService\translateFinisherOption
‪string translateFinisherOption(FormRuntime $formRuntime, string $finisherIdentifier, string $optionKey, string $optionValue, array $renderingOptions=[])
Definition: TranslationService.php:242
‪TYPO3\CMS\Form\Service\TranslationService\getLanguage
‪string getLanguage()
Definition: TranslationService.php:527
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:28
‪TYPO3\CMS\Core\Localization\Locales
Definition: Locales.php:30
‪TYPO3\CMS\Form\Service\TranslationService\$LOCAL_LANG
‪array $LOCAL_LANG
Definition: TranslationService.php:50
‪TYPO3\CMS\Form\Service\TranslationService\processTranslationChain
‪string null processTranslationChain(array $translationKeyChain, string $language=null, array $arguments=null)
Definition: TranslationService.php:538
‪TYPO3\CMS\Form\Service\TranslationService\initializeLocalization
‪initializeLocalization(string $locallangPathAndFilename)
Definition: TranslationService.php:556
‪TYPO3\CMS\Form\Service\TranslationService\translateValuesRecursive
‪array translateValuesRecursive(array $array, array $translationFiles=[])
Definition: TranslationService.php:179
‪TYPO3\CMS\Form\Service
Definition: DatabaseService.php:18
‪TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface\getIdentifier
‪string getIdentifier()
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\CONFIGURATION_TYPE_FRAMEWORK
‪const CONFIGURATION_TYPE_FRAMEWORK
Definition: ConfigurationManagerInterface.php:29
‪TYPO3\CMS\Core\Site\Entity\SiteLanguage
Definition: SiteLanguage.php:26
‪TYPO3\CMS\Form\Service\TranslationService\$LOCAL_LANG_UNSET
‪array $LOCAL_LANG_UNSET
Definition: TranslationService.php:59
‪TYPO3\CMS\Form\Service\TranslationService\translateFormElementError
‪string translateFormElementError(RootRenderableInterface $element, int $code, array $arguments, string $defaultValue='', FormRuntime $formRuntime)
Definition: TranslationService.php:454
‪TYPO3\CMS\Core\Utility\ArrayUtility\getValueByPath
‪static mixed getValueByPath(array $array, $path, $delimiter='/')
Definition: ArrayUtility.php:180
‪TYPO3\CMS\Form\Domain\Model\FormElements\FormElementInterface
Definition: FormElementInterface.php:40
‪TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface
Definition: RootRenderableInterface.php:31
‪TYPO3\CMS\Form\Service\TranslationService\$languageKey
‪string $languageKey
Definition: TranslationService.php:65
‪TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface\getRenderingOptions
‪array getRenderingOptions()
‪$locales
‪$locales
Definition: be_users.php:7
‪TYPO3\CMS\Form\Service\TranslationService\$alternativeLanguageKeys
‪array $alternativeLanguageKeys
Definition: TranslationService.php:71
‪TYPO3\CMS\Form\Service\TranslationService\$configurationManager
‪TYPO3 CMS Extbase Configuration ConfigurationManagerInterface $configurationManager
Definition: TranslationService.php:75
‪TYPO3\CMS\Form\Service\TranslationService\sortArrayWithIntegerKeysDescending
‪array sortArrayWithIntegerKeysDescending(array $array)
Definition: TranslationService.php:675
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\getConfiguration
‪array getConfiguration(string $configurationType, ?string $extensionName=null, ?string $pluginName=null)
‪TYPO3\CMS\Form\Service\TranslationService\translate
‪mixed translate( $key, array $arguments=null, string $locallangPathAndFilename=null, string $language=null, $defaultValue='')
Definition: TranslationService.php:99
‪TYPO3\CMS\Form\Service\TranslationService\flattenTypoScriptLabelArray
‪array flattenTypoScriptLabelArray(array $labelValues, string $parentKey='')
Definition: TranslationService.php:652
‪TYPO3\CMS\Form\Domain\Runtime\FormRuntime
Definition: FormSession.php:18
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:24
‪TYPO3\CMS\Form\Service\TranslationService\loadTypoScriptLabels
‪loadTypoScriptLabels()
Definition: TranslationService.php:609
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:23
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface\getType
‪string getType()
‪TYPO3\CMS\Form\Service\TranslationService\getCurrentSiteLanguage
‪SiteLanguage null getCurrentSiteLanguage()
Definition: TranslationService.php:704
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Form\Domain\Runtime\FormRuntime\getIdentifier
‪string getIdentifier()
Definition: FormRuntime.php:743
‪TYPO3\CMS\Form\Service\TranslationService\translateToAllBackendLanguages
‪array translateToAllBackendLanguages(string $key, array $arguments=null, array $translationFiles=[])
Definition: TranslationService.php:211
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Form\Service\TranslationService\getLanguageService
‪LanguageService getLanguageService()
Definition: TranslationService.php:728
‪TYPO3\CMS\Extbase\Object\ObjectManager
Definition: ObjectManager.php:28
‪TYPO3\CMS\Core\Site\Entity\SiteLanguage\getTypo3Language
‪string getTypo3Language()
Definition: SiteLanguage.php:254