Text

Text handling class.

since

1.0

package

Joomla Framework

Methods

__construct

Constructor

__construct(\Joomla\Language\Language language) : mixed
since

2.0.0-alpha

Arguments

language

\Joomla\Language\LanguageLanguage instance to use in translations

Response

mixed

alt

Translates a string into the current language.

alt(string string, string alt, array parameters = [], mixed jsSafe = false, bool interpretBackSlashes = true) : string
since

1.0

Arguments

string

stringThe string to translate.

alt

stringThe alternate option for global string

parameters

arrayArray of parameters for the string

jsSafe

mixedBoolean: Make the result javascript safe.

interpretBackSlashes

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

Response

stringThe translated string or the key if $script is true

getLanguage

Retrieve the current Language instance

getLanguage() : \Joomla\Language\Language
since

2.0.0-alpha

Response

\Joomla\Language\Language

plural

Pluralises a string in the current language

plural(string string, int n) : string

The last argument can take an array of options to configure the call to Joomla\Language\Language::translate():

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

where:

jsSafe is a boolean to specify whether to make the result JavaScript safe. interpretBackSlashes is a boolean to specify whether backslashes are interpreted (\ -> , \n -> new line, \t -> tab character).

note

This method can take a mixed number of arguments for the sprintf function

since

1.0

Arguments

string

stringThe format string.

n

intThe number of items

Response

stringThe translated string

printf

Passes a string thru an printf.

printf(string string) : string|null

The last argument can take an array of options to configure the call to Joomla\Language\Language::translate():

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

where:

jsSafe is a boolean to specify whether to make the result JavaScript safe. interpretBackSlashes is a boolean to specify whether backslashes are interpreted (\ -> , \n -> new line, \t -> tab character).

note

This method can take a mixed number of arguments for the printf function

since

1.0

Arguments

string

stringThe format string.

Response

string|nullThe translated string

setLanguage

Set the Language object

setLanguage(\Joomla\Language\Language language) : $this
since

2.0.0-alpha

Arguments

language

\Joomla\Language\LanguageLanguage instance

Response

$this

sprintf

Passes a string thru a sprintf.

sprintf(string string) : string|null

The last argument can take an array of options to configure the call to Joomla\Language\Language::translate():

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

where:

jsSafe is a boolean to specify whether to make the result JavaScript safe. interpretBackSlashes is a boolean to specify whether backslashes are interpreted (\ -> , \n -> new line, \t -> tab character).

note

This method can take a mixed number of arguments for the sprintf function

since

1.0

Arguments

string

stringThe format string.

Response

string|nullThe translated string

translate

Translates a string into the current language.

translate(string string, array parameters = [], bool jsSafe = false, bool interpretBackSlashes = true) : string
since

2.0.0-alpha

Arguments

string

stringThe string to translate.

parameters

arrayArray of parameters for the string

jsSafe

boolTrue to escape the string for JavaScript output

interpretBackSlashes

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

Response

stringThe translated string or the key if $script is true

Properties

language

Language instance

since

1.0

Type(s)

\Joomla\Language\Language