TYPO3 API  SVNRelease
Public Member Functions | Public Attributes | Protected Member Functions
language Class Reference

List of all members.

Public Member Functions

 init ($lang, $altPath= '')
 addModuleLabels ($arr, $prefix)
 hscAndCharConv ($lStr, $hsc)
 makeEntities ($str)
 JScharCode ($str)
 getLL ($index, $hsc=0)
 getLLL ($index, $LOCAL_LANG, $hsc=0)
 sL ($input, $hsc=0)
 loadSingleTableDescription ($table)
 includeLLFile ($fileRef, $setGlobal=1, $mergeLocalOntoDefault=0)

Public Attributes

 $lang = 'default'
 $langSplit = 'default'
 $charSet = 'iso-8859-1'
 $charSetArray = array()
 $typo3_help_url = 'http://www.typo3.com/man_uk/'
 $helpUrlArray
 $debugKey = FALSE
 $moduleLabels = array()
 $langSplitIndex = 0
 $LL_files_cache = array()
 $LL_labels_cache = array()
 $csConvObj

Protected Member Functions

 readLLfile ($fileRef)
 localizedFileRef ($fileRef)

Detailed Description

Definition at line 73 of file lang.php.


Member Function Documentation

language::addModuleLabels ( arr,
prefix 
)

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

Parameters:
arrayArray with references to module labels, keys: ['labels']['tablabel'], ['labels']['tabdescr'], ['tabs']['tab']
stringModule name prefix
Returns:
void public
See also:
t3lib_loadModules

Definition at line 182 of file lang.php.

language::getLL ( index,
hsc = 0 
)

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

Parameters:
stringLabel key
booleanIf set, the return value is htmlspecialchar'ed
Returns:
string public

Definition at line 275 of file lang.php.

References $GLOBALS, and hscAndCharConv().

language::getLLL ( index,
LOCAL_LANG,
hsc = 0 
)

Works like ->getLL() but takes the $LOCAL_LANG array used as the second argument instead of using the global array.

Parameters:
stringLabel key
array$LOCAL_LANGarray to get label key from
booleanIf set, the return value is htmlspecialchar'ed
Returns:
string public

Definition at line 297 of file lang.php.

References $LOCAL_LANG, and hscAndCharConv().

Referenced by sL().

language::hscAndCharConv ( lStr,
hsc 
)

Will htmlspecialchar() the input string and before that any charset conversion will also have taken place if needed (see init()) Used to pipe language labels through just before they are returned.

Parameters:
stringThe string to process
booleanIf set, then the string is htmlspecialchars()'ed
Returns:
string The processed string
See also:
init() public

Definition at line 208 of file lang.php.

Referenced by getLL(), getLLL(), and sL().

language::includeLLFile ( fileRef,
setGlobal = 1,
mergeLocalOntoDefault = 0 
)

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$fileRefis a file-reference (see t3lib_div::getFileAbsFileName)
booleanSetting in global variable $LOCAL_LANG (or returning the variable)
booleanIf $mergeLocalOntoDefault is set the local part of the $LOCAL_LANG array is merged onto the default part (if the local part exists) and the local part is unset.
Returns:
mixed If $setGlobal is true the LL-files will set the $LOCAL_LANG in the global scope. Otherwise the $LOCAL_LANG array is returned from function public

Definition at line 464 of file lang.php.

References $GLOBALS, $LOCAL_LANG, t3lib_div\array_merge_recursive_overrule(), t3lib_div\deprecationLog(), localizedFileRef(), and readLLfile().

Referenced by loadSingleTableDescription().

language::init ( lang,
altPath = '' 
)

Initializes the backend language. This is for example done in typo3/template.php with lines like these:

require (PATH_typo3 . 'sysext/lang/lang.php'); $LANG = t3lib_div::makeInstance('language'); $LANG->init($BE_USER->uc['lang']);

Parameters:
stringThe language key (two character string from backend users profile)
stringIGNORE. Not used.
Returns:
void

Definition at line 130 of file lang.php.

References $GLOBALS, $lang, and t3lib_div\makeInstance().

language::JScharCode ( str)

Converts the input string to a JavaScript function returning the same string, but charset-safe. Used for confirm and alert boxes where we must make sure that any string content does not break the script AND want to make sure the charset is preserved. Originally I used the JS function unescape() in combination with PHP function rawurlencode() in order to pass strings in a safe way. This could still be done for iso-8859-1 charsets but now I have applied the same method here for all charsets.

Parameters:
stringInput string, encoded with $this->charSet
Returns:
string Output string, a JavaScript function: "String.fromCharCode(......)" public

Definition at line 253 of file lang.php.

language::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:
stringTable name found as key in global array $TCA_DESCR
Returns:
void public

Definition at line 387 of file lang.php.

References $LOCAL_LANG, and includeLLFile().

language::localizedFileRef ( fileRef) [protected]

Returns localized fileRef (.[langkey].php)

Parameters:
stringFilename/path of a 'locallang.php' file
Returns:
string Input filename with a '.[lang-key].php' ending added if $this->lang is not 'default' private

Definition at line 526 of file lang.php.

Referenced by includeLLFile(), and sL().

language::makeEntities ( str)

Will convert the input strings special chars (all above 127) to entities. The string is expected to be encoded in the charset, $this->charSet 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:
stringInput string
Returns:
string Output string public

Definition at line 231 of file lang.php.

language::readLLfile ( fileRef) [protected]

Includes a locallang file and returns the $LOCAL_LANG array found inside.

Parameters:
stringInput is a file-reference (see t3lib_div::getFileAbsFileName) which, if exists, is included. That file is expected to be a 'local_lang' file containing a $LOCAL_LANG array.
Returns:
array Value of $LOCAL_LANG found in the included file. If that array is found it's returned. Otherwise an empty array private

Definition at line 515 of file lang.php.

Referenced by includeLLFile(), and sL().

language::sL ( input,
hsc = 0 
)

splitLabel function Historically labels were exploded by '|' and each part would correspond to the translation of the language found at the same 'index' in the TYPO3_languages constant. Today all translations are based on $LOCAL_LANG variables. 'language-splitted' labels can therefore refer to a local-lang file + index instead! It's highly recommended to use the 'local_lang' method (and thereby it's highly deprecated to use 'language-splitted' label strings) Refer to 'Inside TYPO3' for more details

Parameters:
stringLabel key/reference
booleanIf set, the return value is htmlspecialchar'ed
Returns:
string public

Definition at line 324 of file lang.php.

References $GLOBALS, t3lib_div\array_merge_recursive_overrule(), t3lib_div\deHSCentities(), t3lib_div\deprecationLog(), getLLL(), hscAndCharConv(), localizedFileRef(), and readLLfile().


Member Data Documentation

language::$charSet = 'iso-8859-1'

Definition at line 82 of file lang.php.

language::$charSetArray = array()

Definition at line 86 of file lang.php.

language::$csConvObj

Definition at line 116 of file lang.php.

language::$debugKey = FALSE

Definition at line 97 of file lang.php.

language::$helpUrlArray
Initial value:
 array(
        'dk' => 'http://www.typo3.com/man_dk/',
    )

Definition at line 92 of file lang.php.

language::$lang = 'default'

Definition at line 75 of file lang.php.

Referenced by init().

language::$langSplit = 'default'

Definition at line 79 of file lang.php.

language::$langSplitIndex = 0

Definition at line 105 of file lang.php.

language::$LL_files_cache = array()

Definition at line 107 of file lang.php.

language::$LL_labels_cache = array()

Definition at line 109 of file lang.php.

language::$moduleLabels = array()

Definition at line 101 of file lang.php.

language::$typo3_help_url = 'http://www.typo3.com/man_uk/'

Definition at line 89 of file lang.php.


The documentation for this class was generated from the following file: