Text
Text handling class.
| since |
1.0 |
|---|---|
| package |
Joomla Framework |
Methods
__construct
Constructor
__construct(\Joomla\Language\Language language) :
alt
Translates a string into the current language.
alt( string, alt, mixed||string|int parameters = [], jsSafe = false, interpretBackSlashes = true) :
| since |
1.0 |
|---|
Arguments
- string
stringThe string to translate.- alt
stringThe alternate option for global string- parameters
array<string|int, mixed>Array 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
plural
Pluralises a string in the current language
plural( string, n) :
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) :
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
intThe length of the outputted string
setLanguage
Set the Language object
setLanguage(\Joomla\Language\Language language) :
sprintf
Passes a string thru a sprintf.
sprintf( 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, mixed||string|int parameters = [], jsSafe = false, interpretBackSlashes = true) :
| since |
2.0 |
|---|
Arguments
- string
stringThe string to translate.- parameters
array<string|int, mixed>Array 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