TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Lang\LanguageService Class Reference

Public Member Functions

 getParserFactory ()
 
 addModuleLabels ($arr, $prefix)
 
 makeEntities ($str)
 
 debugLL ($value)
 
 getLL ($index, $hsc=false)
 
 getLLL ($index, $localLanguage, $hsc=false)
 
 sL ($input, $hsc=false)
 
 loadSingleTableDescription ($table)
 
 includeLLFile ($fileRef, $setGlobal=true, $mergeLocalOntoDefault=false)
 
 overrideLL ($index, $value, $overrideDefault=true)
 
 getLabelsWithPrefix ($prefix, $strip='')
 

Public Attributes

 $lang = 'default'
 
 $charSet = 'utf-8'
 
 $debugKey = false
 
 $moduleLabels = []
 
 $LL_files_cache = []
 
 $LL_labels_cache = []
 
 $csConvObj
 
 $parserFactory
 

Protected Member Functions

 localizedFileRef ($fileRef)
 

Protected Attributes

 $languageDependencies = []
 

Detailed Description

Contains the TYPO3 Backend Language class For detailed information about how localization is handled, please refer to the 'Inside TYPO3' document which describes this. This class is normally instantiated as the global variable $GLOBALS['LANG'] It's only available in the backend and under certain circumstances in the frontend

See also

Definition at line 29 of file LanguageService.php.

Member Function Documentation

◆ addModuleLabels()

TYPO3\CMS\Lang\LanguageService::addModuleLabels (   $arr,
  $prefix 
)

Adds labels and image references from the backend modules to the internal moduleLabels array

Parameters
array$arrArray with references to module labels, keys: ['labels']['table'],
string$prefixModule name prefix
Returns
void
See also

Definition at line 148 of file LanguageService.php.

◆ debugLL()

TYPO3\CMS\Lang\LanguageService::debugLL (   $value)

Debugs localization key.

Parameters
string$valuevalue to debug
Returns
string

Definition at line 188 of file LanguageService.php.

Referenced by TYPO3\CMS\Lang\LanguageService\getLLL(), and TYPO3\CMS\Lang\LanguageService\sL().

◆ getLabelsWithPrefix()

TYPO3\CMS\Lang\LanguageService::getLabelsWithPrefix (   $prefix,
  $strip = '' 
)

Gets labels with a specific fetched from the current locallang file. This is useful for e.g gathering javascript labels.

Parameters
string$prefixPrefix to select the correct labels
string$stripSub-prefix to be removed from label names in the result
Returns
array Processed labels

Definition at line 475 of file LanguageService.php.

References $GLOBALS.

◆ getLL()

TYPO3\CMS\Lang\LanguageService::getLL (   $index,
  $hsc = false 
)

Returns the label with key $index from the globally loaded $LOCAL_LANG array. Mostly used from modules with only one LOCAL_LANG file loaded into the global space.

Parameters
string$indexLabel key
bool$hscIf set, the return value is htmlspecialchar'ed
Returns
string

Definition at line 201 of file LanguageService.php.

References $GLOBALS, and TYPO3\CMS\Lang\LanguageService\getLLL().

◆ getLLL()

TYPO3\CMS\Lang\LanguageService::getLLL (   $index,
  $localLanguage,
  $hsc = false 
)

Returns the label with key $index from the $LOCAL_LANG array used as the second argument

Parameters
string$indexLabel key
array$localLanguage$LOCAL_LANG array to get label key from
bool$hscIf set, the return value is htmlspecialchar'ed
Returns
string

Definition at line 214 of file LanguageService.php.

References TYPO3\CMS\Lang\LanguageService\$lang, and TYPO3\CMS\Lang\LanguageService\debugLL().

Referenced by TYPO3\CMS\Lang\LanguageService\getLL(), and TYPO3\CMS\Lang\LanguageService\sL().

◆ getParserFactory()

TYPO3\CMS\Lang\LanguageService::getParserFactory ( )

Gets the parser factory.

Returns
LocalizationFactory

Definition at line 135 of file LanguageService.php.

References TYPO3\CMS\Lang\LanguageService\$parserFactory.

◆ includeLLFile()

TYPO3\CMS\Lang\LanguageService::includeLLFile (   $fileRef,
  $setGlobal = true,
  $mergeLocalOntoDefault = false 
)

Includes locallang file (and possibly additional localized version if configured for) Read language labels will be merged with $LOCAL_LANG (if $setGlobal = TRUE).

Parameters
string$fileRef$fileRef is a file-reference
bool$setGlobalSetting in global variable $LOCAL_LANG (or returning the variable)
bool$mergeLocalOntoDefault
Returns
mixed if $setGlobal===TRUE, LL-files set $LOCAL_LANG in global scope, or array is returned from function

Definition at line 359 of file LanguageService.php.

References $GLOBALS, TYPO3\CMS\Lang\LanguageService\$lang, TYPO3\CMS\Lang\LanguageService\localizedFileRef(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Utility\ArrayUtility\mergeRecursiveWithOverrule().

Referenced by TYPO3\CMS\Lang\LanguageService\loadSingleTableDescription().

◆ loadSingleTableDescription()

TYPO3\CMS\Lang\LanguageService::loadSingleTableDescription (   $table)

Loading $TCA_DESCR[$table]['columns'] with content from locallang files as defined in $TCA_DESCR[$table]['refs'] $TCA_DESCR is a global var

Parameters
string$tableTable name found as key in global array $TCA_DESCR
Returns
void

Definition at line 293 of file LanguageService.php.

References $GLOBALS, and TYPO3\CMS\Lang\LanguageService\includeLLFile().

◆ localizedFileRef()

TYPO3\CMS\Lang\LanguageService::localizedFileRef (   $fileRef)
protected

Returns localized fileRef (.[langkey].php)

Parameters
string$fileRefFilename/path of a 'locallang.php' file
Returns
string Input filename with a '.[lang-key].php' ending added if $this->lang is not 'default'
Deprecated:
since TYPO3 CMS 7, this method will be removed in CMS 8. Please use XLF files for translation handling.

Definition at line 438 of file LanguageService.php.

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

Referenced by TYPO3\CMS\Lang\LanguageService\includeLLFile(), and TYPO3\CMS\Lang\LanguageService\sL().

◆ makeEntities()

TYPO3\CMS\Lang\LanguageService::makeEntities (   $str)

Will convert the input strings special chars (all above 127) to entities. The string is expected to be encoded in UTF-8 This function is used to create strings that can be used in the Click Menu (Context Sensitive Menus). The reason is that the values that are dynamically written into the

layer is decoded as iso-8859-1 no matter what charset is used in the document otherwise (only MSIE, Mozilla is OK). So by converting we by-pass this problem.
Parameters
string$strInput string
Returns
string Output string

Definition at line 176 of file LanguageService.php.

◆ overrideLL()

TYPO3\CMS\Lang\LanguageService::overrideLL (   $index,
  $value,
  $overrideDefault = true 
)

Overrides a label.

Parameters
string$index
string$value
bool$overrideDefaultOverrides default language
Returns
void

Definition at line 456 of file LanguageService.php.

References $GLOBALS, and TYPO3\CMS\Lang\LanguageService\$lang.

◆ sL()

TYPO3\CMS\Lang\LanguageService::sL (   $input,
  $hsc = false 
)

splitLabel function

All translations are based on $LOCAL_LANG variables. 'language-splitted' labels can therefore refer to a local-lang file + index. Refer to 'Inside TYPO3' for more details

Parameters
string$inputLabel key/reference
bool$hscIf set, the return value is htmlspecialchar'ed
Returns
string

Definition at line 246 of file LanguageService.php.

References TYPO3\CMS\Lang\LanguageService\$debugKey, TYPO3\CMS\Lang\LanguageService\$lang, TYPO3\CMS\Lang\LanguageService\debugLL(), TYPO3\CMS\Lang\LanguageService\getLLL(), and TYPO3\CMS\Lang\LanguageService\localizedFileRef().

Referenced by TYPO3\CMS\Core\FormProtection\FormProtectionFactory\isFrontendSession().

Member Data Documentation

◆ $charSet

TYPO3\CMS\Lang\LanguageService::$charSet = 'utf-8'

Definition at line 43 of file LanguageService.php.

◆ $csConvObj

TYPO3\CMS\Lang\LanguageService::$csConvObj

Definition at line 79 of file LanguageService.php.

◆ $debugKey

TYPO3\CMS\Lang\LanguageService::$debugKey = false

Definition at line 50 of file LanguageService.php.

Referenced by TYPO3\CMS\Lang\LanguageService\sL().

◆ $lang

◆ $languageDependencies

TYPO3\CMS\Lang\LanguageService::$languageDependencies = []
protected

Definition at line 94 of file LanguageService.php.

◆ $LL_files_cache

TYPO3\CMS\Lang\LanguageService::$LL_files_cache = []

Definition at line 65 of file LanguageService.php.

◆ $LL_labels_cache

TYPO3\CMS\Lang\LanguageService::$LL_labels_cache = []

Definition at line 72 of file LanguageService.php.

◆ $moduleLabels

TYPO3\CMS\Lang\LanguageService::$moduleLabels = []

Definition at line 58 of file LanguageService.php.

◆ $parserFactory

TYPO3\CMS\Lang\LanguageService::$parserFactory

Definition at line 86 of file LanguageService.php.

Referenced by TYPO3\CMS\Lang\LanguageService\getParserFactory().