‪TYPO3CMS  10.4
TYPO3\CMS\Core\Localization\Locales Class Reference
Inheritance diagram for TYPO3\CMS\Core\Localization\Locales:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct ()
 
array getLocales ()
 
array getLanguages ()
 
array getIsoMapping ()
 
array getLocaleDependencies ($locale)
 
string getPreferredClientLanguage ($languageCodesList)
 

Static Public Member Functions

static Locales initialize ()
 
static bool setSystemLocaleFromSiteLanguage (SiteLanguage $siteLanguage)
 

Static Protected Member Functions

static setLocale (string $locale, string $localeStringForTrigger)
 

Protected Attributes

array $languages
 
array $isoReverseMapping
 
array $localeDependencies
 

Detailed Description

Locales. Used to define TYPO3- system languages When adding new keys, remember to:

  • ‪Update 'setup' extension labels (sysext/setup/Resources/Private/Language/locallang.xlf) That's it!

Definition at line 29 of file Locales.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Localization\Locales::__construct ( )

Definition at line 130 of file Locales.php.

References $GLOBALS.

Member Function Documentation

◆ getIsoMapping()

array TYPO3\CMS\Core\Localization\Locales::getIsoMapping ( )

Returns the mapping between TYPO3 (old) language codes and ISO codes.

Returns
‪array

Definition at line 187 of file Locales.php.

◆ getLanguages()

array TYPO3\CMS\Core\Localization\Locales::getLanguages ( )

Returns the supported languages indexed by their corresponding locale.

Returns
‪array

Definition at line 177 of file Locales.php.

References TYPO3\CMS\Core\Localization\Locales\$languages.

◆ getLocaleDependencies()

array TYPO3\CMS\Core\Localization\Locales::getLocaleDependencies (   $locale)

Returns the dependencies of a given locale, if any.

Parameters
string$locale
Returns
‪array

Definition at line 198 of file Locales.php.

References TYPO3\CMS\Core\Localization\Locales\$localeDependencies.

◆ getLocales()

array TYPO3\CMS\Core\Localization\Locales::getLocales ( )

Returns the locales.

Returns
‪array

Definition at line 167 of file Locales.php.

Referenced by TYPO3\CMS\Core\Localization\Locales\getPreferredClientLanguage().

◆ getPreferredClientLanguage()

string TYPO3\CMS\Core\Localization\Locales::getPreferredClientLanguage (   $languageCodesList)

Converts the language codes that we get from the client (usually HTTP_ACCEPT_LANGUAGE) into a TYPO3-readable language code

Parameters
string$languageCodesList‪List of language codes. something like 'de,en-us;q=0.9,de-de;q=0.7,es-cl;q=0.6,en;q=0.4,es;q=0.3,zh;q=0.1'
Returns
‪string A preferred language that TYPO3 supports, or "default" if none found

Definition at line 221 of file Locales.php.

References TYPO3\CMS\Core\Localization\Locales\getLocales(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

◆ initialize()

static Locales TYPO3\CMS\Core\Localization\Locales::initialize ( )
static

Initializes the languages.

Returns
Locales
Deprecated:
‪will be removed in TYPO3 v11.0. Use the regular constructor instead.

Definition at line 156 of file Locales.php.

◆ setLocale()

static TYPO3\CMS\Core\Localization\Locales::setLocale ( string  $locale,
string  $localeStringForTrigger 
)
staticprotected

Internal method, which calls itself again, in order to avoid multiple logging issues. The main reason for this method is that it calls itself again by trying again to set the locale. Due to sensible defaults, people used the locale "de_AT.utf-8" with the POSIX platform (see https://en.wikipedia.org/wiki/Locale_(computer_software)#POSIX_platforms) in their site configuration, even though the target system has "de_AT" and not "de_AT.UTF-8" defined. "setLocale()" is now called again without the POSIX platform suffix and is checked again if the locale is then available, and then logs the failed information.

Definition at line 289 of file Locales.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Core\Localization\Locales\setSystemLocaleFromSiteLanguage().

◆ setSystemLocaleFromSiteLanguage()

static bool TYPO3\CMS\Core\Localization\Locales::setSystemLocaleFromSiteLanguage ( SiteLanguage  $siteLanguage)
static

Member Data Documentation

◆ $isoReverseMapping

array TYPO3\CMS\Core\Localization\Locales::$isoReverseMapping
protected
Initial value:
= array(
'bs' => 'ba',
'cs' => 'cz',
'da' => 'dk',
'el' => 'gr',
'fr_CA' => 'qc',
'gl' => 'ga',
'ja' => 'jp',
'ka' => 'ge',
'kl' => 'gl',
'ko' => 'kr',
'ms' => 'my',
'pt_BR' => 'br',
'sl' => 'si',
'sv' => 'se',
'uk' => 'ua',
'vi' => 'vn',
'zh' => 'hk',
'zh_CN' => 'ch',
'zh_HK' => 'hk',
'zh_Hans_CN' => 'ch'
)

Reversed mapping for backward compatibility codes

Definition at line 97 of file Locales.php.

◆ $languages

array TYPO3\CMS\Core\Localization\Locales::$languages
protected

Supported TYPO3 languages with locales

Definition at line 35 of file Locales.php.

Referenced by TYPO3\CMS\Core\Localization\Locales\getLanguages().

◆ $localeDependencies

array TYPO3\CMS\Core\Localization\Locales::$localeDependencies
protected
Initial value:
= array(
'pt_BR' => ['pt'],
'fr_CA' => ['fr']
)

Dependencies for locales This is a reverse mapping for the built-in languages within $this->languages that contain 5-letter codes.

Definition at line 125 of file Locales.php.

Referenced by TYPO3\CMS\Core\Localization\Locales\getLocaleDependencies().