Skip to content
Snippets Groups Projects
Commit f3aeff7f authored by Benni Mack's avatar Benni Mack Committed by Susanne Moog
Browse files

[TASK] Instantiate $GLOBALS[LANG] via factory

LanguageService a.k.a. $GLOBALS[LANG] is used in various places,
not just for backend-labels anymore. The "init()" method (which stems
from the fact that PHP did not have constructors !!! back then), should
be covered - which is now done via factory methods.

The goal of the factory methods are to explicitly define the dependencies
where LanguageService is used, instead of calling "init()" in the emitters
code.

This change is a pre-cursor for TYPO3 to
- avoid accessing Bootstrap API for initializing $GLOBALS[LANG]
- streamline the various places where this API is instantiated
- have a first step to switch to "real" locales at _some_ point
- and eventually get rid of accessing LanguageService via globals.

In addition the PHP class comments are streamlined to reflect
the purpose of this class.

The next step is to adapt the testing framework to easily use this
API so our tests will not have to worry about $GLOBALS[LANG]
anymore.

My 2c: We should actually rename "LanguageService" to "LabelService"
or "LabelProvider" at some point.

Resolves: #90062
Releases: master
Change-Id: Ib1b6a8aacb2c2aecc3ab2931db04002dd02f0a99
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62826


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarJörg Bösche <typo3@joergboesche.de>
Tested-by: default avatarSascha Rademacher <sascha.rademacher+typo3@gmail.com>
Tested-by: default avatarHenning Liebe <h.liebe@neusta.de>
Tested-by: default avatarSusanne Moog <look@susi.dev>
Reviewed-by: default avatarJörg Bösche <typo3@joergboesche.de>
Reviewed-by: default avatarSascha Rademacher <sascha.rademacher+typo3@gmail.com>
Reviewed-by: default avatarHenning Liebe <h.liebe@neusta.de>
Reviewed-by: default avatarSusanne Moog <look@susi.dev>
parent e4225a8e
Branches
Tags
Showing
with 63 additions and 35 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment