LanguageServiceFactory

This factory class is for retrieving the LanguageService at runtime, which then is used to translate strings in plain PHP. For examples see Localization in PHP. Creates a LanguageService that can then be used for localizations.

class TYPO3\CMS\Core\Localization\LanguageServiceFactory
create(TYPO3\\CMS\\Core\\Localization\\Locale|string $locale)

Factory method to create a language service object.

Parameters
  • $locale (TYPO3\CMS\Core\Localization\Locale|string) -- the locale

Return type

TYPO3\CMS\Core\Localization\LanguageService

createFromUserPreferences(TYPO3\\CMS\\Core\\Authentication\\AbstractUserAuthentication $user)
Parameters
  • $user (TYPO3\CMS\Core\Authentication\AbstractUserAuthentication) -- the user

Return type

TYPO3\CMS\Core\Localization\LanguageService

createFromSiteLanguage(TYPO3\\CMS\\Core\\Site\\Entity\\SiteLanguage $language)
Parameters
Return type

TYPO3\CMS\Core\Localization\LanguageService