Actions

API15

JText/script

From Joomla! Documentation

< API15:JText
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Translate a string into the current language and stores it in the JavaScript language store.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

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;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />