TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
LanguageService Class Reference

Public Member Functions

 __construct ()
 
 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 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 31 of file LanguageService.php.

Constructor & Destructor Documentation

__construct ( )

LanguageService constructor.

Definition at line 106 of file LanguageService.php.

References $GLOBALS, and GeneralUtility\makeInstance().

Member Function Documentation

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
Deprecated:
since TYPO3 v8, will be removed in TYPO3 v9 - use ModuleLoader instead.

Definition at line 164 of file LanguageService.php.

References GeneralUtility\logDeprecatedFunction().

debugLL (   $value)

Debugs localization key.

Parameters
string$valuevalue to debug
Returns
string

Definition at line 207 of file LanguageService.php.

Referenced by LanguageService\getLLL(), and LanguageService\sL().

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 477 of file LanguageService.php.

References $GLOBALS.

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$hscDEPRECATED If set, the return value is htmlspecialchar'ed
Returns
string

Definition at line 220 of file LanguageService.php.

References $GLOBALS, and LanguageService\getLLL().

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$hscDEPRECATED If set, the return value is htmlspecialchar'ed
Returns
string

Definition at line 233 of file LanguageService.php.

References LanguageService\$lang, LanguageService\debugLL(), and GeneralUtility\deprecationLog().

Referenced by LanguageService\getLL(), and LanguageService\sL().

getParserFactory ( )

Gets the parser factory.

Returns
LocalizationFactory
Deprecated:
since TYPO3 v8, will be removed in TYPO3 v9

Definition at line 149 of file LanguageService.php.

References LanguageService\$parserFactory, and GeneralUtility\logDeprecatedFunction().

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 386 of file LanguageService.php.

References $GLOBALS, and ArrayUtility\mergeRecursiveWithOverrule().

Referenced by LanguageService\loadSingleTableDescription().

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 320 of file LanguageService.php.

References $GLOBALS, and LanguageService\includeLLFile().

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
Deprecated:
since TYPO3 v8, will be removed in TYPO3 v9

Definition at line 194 of file LanguageService.php.

References GeneralUtility\logDeprecatedFunction().

overrideLL (   $index,
  $value,
  $overrideDefault = true 
)

Overrides a label.

Parameters
string$index
string$value
bool$overrideDefaultOverrides default language
Returns
void
Deprecated:
since TYPO3 v8, will be removed in TYPO3 v9

Definition at line 457 of file LanguageService.php.

References $GLOBALS, LanguageService\$lang, and GeneralUtility\logDeprecatedFunction().

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$hscDEPRECATED If set, the return value is htmlspecialchar'ed
Returns
string

Definition at line 272 of file LanguageService.php.

References LanguageService\$debugKey, LanguageService\$lang, LanguageService\debugLL(), GeneralUtility\deprecationLog(), and LanguageService\getLLL().

Member Data Documentation

$charSet = 'utf-8'

Definition at line 46 of file LanguageService.php.

$csConvObj

Definition at line 84 of file LanguageService.php.

$debugKey = false

Definition at line 53 of file LanguageService.php.

Referenced by LanguageService\sL().

$lang = 'default'
$languageDependencies = []
protected

Definition at line 101 of file LanguageService.php.

$LL_files_cache = []

Definition at line 69 of file LanguageService.php.

$LL_labels_cache = []

Definition at line 76 of file LanguageService.php.

$moduleLabels = []

Definition at line 62 of file LanguageService.php.

$parserFactory

Definition at line 93 of file LanguageService.php.

Referenced by LanguageService\getParserFactory().