Actions

API16

JText/script

< API16:JText

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

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


Advertisement