TYPO3  7.6
Static Public Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
LocalizationUtility Class Reference

Static Public Member Functions

static translate ($key, $extensionName, $arguments=null)
 

Static Protected Member Functions

static translateFileReference ($key)
 
static loadTypoScriptLabels ($extensionName)
 
static flattenTypoScriptLabelArray (array $labelValues, $parentKey= '')
 
static convertCharset ($value, $charset)
 
static getConfigurationManager ()
 
static getTypoScriptFrontendController ()
 
static getLanguageService ()
 

Static Protected Attributes

static $locallangPath = 'Resources/Private/Language/'
 
static $LOCAL_LANG = array()
 
static $LOCAL_LANG_UNSET = array()
 
static $LOCAL_LANG_charset = array()
 
static $languageKey = 'default'
 
static $alternativeLanguageKeys = array()
 
static $configurationManager = null
 

Detailed Description

Localization helper which should be used to fetch localized labels.

Definition at line 28 of file LocalizationUtility.php.

Member Function Documentation

static convertCharset (   $value,
  $charset 
)
staticprotected

Converts a string from the specified character set to the current. The current charset is defined by the TYPO3 mode.

Parameters
string$valuestring to be converted
string$charsetThe source charset
Returns
string converted string

Definition at line 296 of file LocalizationUtility.php.

static flattenTypoScriptLabelArray ( array  $labelValues,
  $parentKey = '' 
)
staticprotected

Flatten TypoScript label array; converting a hierarchical array into a flat array with the keys separated by dots.

Example Input: array('k1' => array('subkey1' => 'val1')) Example Output: array('k1.subkey1' => 'val1')

Parameters
array$labelValuesHierarchical array of labels
string$parentKeythe name of the parent key in the recursion; is only needed for recursion.
Returns
array flattened array of labels.

Definition at line 271 of file LocalizationUtility.php.

static getConfigurationManager ( )
staticprotected

Returns instance of the configuration manager

Returns

Definition at line 311 of file LocalizationUtility.php.

References LocalizationUtility\$configurationManager, and GeneralUtility\makeInstance().

static getLanguageService ( )
staticprotected
Returns

Definition at line 333 of file LocalizationUtility.php.

References $GLOBALS.

static getTypoScriptFrontendController ( )
staticprotected
Returns

Definition at line 325 of file LocalizationUtility.php.

References $GLOBALS.

static loadTypoScriptLabels (   $extensionName)
staticprotected

Overwrites labels that are set via TypoScript. TS locallang labels have to be configured like: plugin.tx_myextension._LOCAL_LANG.languageKey.key = value

Parameters
string$extensionName
Returns
void

Definition at line 224 of file LocalizationUtility.php.

References LocalizationUtility\$configurationManager, $GLOBALS, LocalizationUtility\$languageKey, ConfigurationManagerInterface\CONFIGURATION_TYPE_FRAMEWORK, and elseif.

static translate (   $key,
  $extensionName,
  $arguments = null 
)
static

Returns the localized label of the LOCAL_LANG key, $key.

Parameters
string$keyThe key from the LOCAL_LANG array for which to return the value.
string$extensionNameThe name of the extension
array$argumentsthe arguments of the extension, being passed over to vsprintf
Returns
string|NULL The value from LOCAL_LANG or NULL if no translation was found.
Todo:
: If vsprintf gets a malformed string, it returns FALSE! Should we throw an exception there?

Definition at line 88 of file LocalizationUtility.php.

References elseif, and GeneralUtility\isFirstPartOfStr().

Referenced by ListController\addComposerModeNotification(), SystemInformationController\appendMessage(), SearchController\compileResultRows(), SearchController\compileSingleResultRow(), FrontendController\confirmationAction(), AbstractController\createPageDepthOptions(), RecyclerAjaxController\dispatch(), PermissionController\editAction(), DocumentController\fetchAction(), SearchController\getAllAvailableGroupOptions(), SearchController\getAllAvailableIndexConfigurationsOptions(), SearchController\getAllAvailableLanguageOptions(), SearchController\getAllAvailableMediaTypesOptions(), SearchController\getAllAvailableOperandsOptions(), SearchController\getAllAvailableSearchTypeOptions(), SearchController\getAllAvailableSectionsOptions(), SearchController\getAllAvailableSortDescendingOptions(), SearchController\getAllAvailableSortOrderOptions(), SearchController\getDisplayResults(), UserFileInlineLabelService\getInlineLabel(), MailPostProcessor\getLocalLanguageLabel(), PermissionController\getRecursiveSelectOptions(), SearchController\getSearchWords(), DownloadController\installDistributionAction(), SearchController\makeDescription(), SearchController\makeRating(), ConfigurationView\menuConfig(), ActionController\removeExtensionAction(), RemoveExtensionViewHelper\render(), DownloadExtensionViewHelper\render(), PageRendererViewHelper\render(), ContainerViewHelper\render(), PageBrowsingResultsViewHelper\renderStatic(), SwitchUserViewHelper\renderStatic(), PermissionsViewHelper\renderStatic(), PageBrowsingViewHelper\renderStatic(), BytesViewHelper\renderStatic(), SearchController\searchAction(), FileListController\searchAction(), BackendUserController\terminateBackendUserSessionAction(), and TranslateViewHelper\translate().

static translateFileReference (   $key)
staticprotected

Returns the localized label of the LOCAL_LANG key, $key.

Parameters
string$keyThe language key including the path to a custom locallang file ("LLL:path:key").
Returns
string The value from LOCAL_LANG or NULL if no translation was found.
See Also
language::sL()
::sL()

Definition at line 142 of file LocalizationUtility.php.

References $GLOBALS, and elseif.

Member Data Documentation

$alternativeLanguageKeys = array()
staticprotected

Definition at line 71 of file LocalizationUtility.php.

$configurationManager = null
staticprotected
$languageKey = 'default'
staticprotected

Definition at line 64 of file LocalizationUtility.php.

Referenced by LocalizationUtility\loadTypoScriptLabels().

$LOCAL_LANG = array()
staticprotected

Definition at line 40 of file LocalizationUtility.php.

$LOCAL_LANG_charset = array()
staticprotected

Definition at line 57 of file LocalizationUtility.php.

$LOCAL_LANG_UNSET = array()
staticprotected

Definition at line 50 of file LocalizationUtility.php.

$locallangPath = 'Resources/Private/Language/'
staticprotected

Definition at line 33 of file LocalizationUtility.php.