Review main Merged

62826[TASK] Instantiate $GLOBALS[LANG] via factory

Benni Mack CR +2 V +2 Normal +63 −35 updated 01/14/20, 11:48

Commit message

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.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 12