TranslatorServiceProvider
in package
implements
ServiceProviderInterface
Registers the Translator as a singleton and sets the active locale from the database during the boot phase.
Tags
Table of Contents
Interfaces
- ServiceProviderInterface
- Interface for service providers that register services in the container.
Methods
- boot() : void
- Read the user's locale preference from settings and apply it.
- register() : void
- Register the Translator singleton.
Methods
boot()
Read the user's locale preference from settings and apply it.
public
boot(Container $container) : void
Runs after all providers are registered, so the DB is available. Silently defaults to English if the DB is not yet configured (e.g. during the setup wizard).
Parameters
- $container : Container
-
The DI container
register()
Register the Translator singleton.
public
register(Container $container) : void
Parameters
- $container : Container
-
The DI container