Text

Text handling class.

since

1.0

package

Joomla Framework

Methods

_

Translates a string into the current language.

_(string string, mixed jsSafe = false, bool interpretBackSlashes = true, bool script = false) : string
static deprecated

Examples:

<script>alert(Joomla.JText._('true));?>'));</script>

will generate an alert message containing 'Default'

it will generate a 'Default' string
since

1.0

deprecated

2.0 Will be replaced with a translate method.

Arguments

string

stringThe string to translate.

jsSafe

mixedBoolean: Make the result javascript safe.

interpretBackSlashes

boolTo interpret backslashes (\=, \n=carriage return, \t=tabulation)

script

boolTo indicate that the string will be push in the javascript language store [@deprecated 2.0]

Response

stringThe translated string or the key is $script is true

alt

Translates a string into the current language.

alt(string string, string alt, mixed jsSafe = false, bool interpretBackSlashes = true, bool script = false) : string
static

Examples:

it will generate a 'All' string in English but a "Toutes" string in French it will generate a 'All' string in English but a "Tous" string in French
since

1.0

Arguments

string

stringThe string to translate.

alt

stringThe alternate option for global string

jsSafe

mixedBoolean: Make the result javascript safe.

interpretBackSlashes

boolTo interpret backslashes (\=, \n=carriage return, \t=tabulation)

script

boolTo indicate that the string will be pushed in the javascript language store [@deprecated 2.0]

Response

stringThe translated string or the key if $script is true

getLanguage

Get Text Language

getLanguage() : \Joomla\Language\Language
static

Response

\Joomla\Language\Language

plural

Like JText::sprintf but tries to pluralise the string.

plural(string string, int n) : string
static

Note that this method can take a mixed number of arguments as for the sprintf function.

The last argument can take an array of options:

array('jsSafe'=>boolean, 'interpretBackSlashes'=>boolean, 'script'=>boolean)

where:

jsSafe is a boolean to generate a javascript safe strings. interpretBackSlashes is a boolean to interpret backslashes \->, \n->new line, \t->tabulation. script is a boolean to indicate that the string will be push in the javascript language store.

Examples:

<script>alert(Joomla.JText._('true));?>'));</script>

will generate an alert message containing '1 plugin successfully disabled'

it will generate a '1 plugin successfully disabled' string
since

1.0

Arguments

string

stringThe format string.

n

intThe number of items

Response

stringThe translated strings or the key if 'script' is true in the array of options

printf

Passes a string thru an printf.

printf(string string) : mixed
static

Note that this method can take a mixed number of arguments as for the sprintf function.

since

1.0

Arguments

string

stringThe format string.

Response

mixed

script

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

script(string string = null, bool jsSafe = false, bool interpretBackSlashes = true) : string
static deprecated
since

1.0

deprecated

2.0 Deprecated without replacement

Arguments

string

stringThe JText key.

jsSafe

boolEnsure the output is JavaScript safe.

interpretBackSlashes

boolInterpret \t and \n.

Response

string

setLanguage

Set Text languge

setLanguage(\Joomla\Language\Language lang) : void
static

Arguments

lang

\Joomla\Language\LanguageLanguage instance

sprintf

Passes a string thru a sprintf.

sprintf(string string) : string
static

Note that this method can take a mixed number of arguments as for the sprintf function.

The last argument can take an array of options:

array('jsSafe'=>boolean, 'interpretBackSlashes'=>boolean, 'script'=>boolean)

where:

jsSafe is a boolean to generate a javascript safe strings. interpretBackSlashes is a boolean to interpret backslashes \->, \n->new line, \t->tabulation. script is a boolean to indicate that the string will be push in the javascript language store.

since

1.0

Arguments

string

stringThe format string.

Response

stringThe translated strings or the key if 'script' is true in the array of options.

Properties

strings

JavaScript strings

static deprecated
since

1.0

deprecated

2.0

Type(s)

array

lang

Language instance

static
since

1.0

Type(s)

\Joomla\Language\Language