API16:JText/script
From Joomla! Documentation
Description
Translate a string into the current language and stores it in the JavaScript language store.
Syntax
static script($string=null)
Parameter Name | Default Value | Description |
---|---|---|
$string | null | $string The key. |
Returns
void
Defined in
libraries/joomla/methods.php
Importing
jimport( 'joomla.methods' );
Source Body
public static function script($string = null)
{
static $strings;
// Instante the array if necessary.
if (!is_array($strings)) {
$strings = array();
}
// Add the string to the array if not null.
if ($string !== null) {
// Normalize the key and translate the string.
$strings[strtoupper($string)] = JFactory::getLanguage()->_($string);
}
return $strings;
}
Examples
Code Examples