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\Language
Language 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
string
The string to translate.- alt
string
The alternate option for global string- parameters
array
Array of parameters for the string- jsSafe
mixed
Boolean: Make the result javascript safe.- interpretBackSlashes
bool
To interpret backslashes (\=, \n=carriage return, \t=tabulation)
Response
string
The 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
string
The format string.- n
int
The number of items
Response
string
The 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
string
The format string.
Response
string|null
The translated string
setLanguage
Set the Language object
setLanguage(\Joomla\Language\Language language) : $this
since |
2.0.0-alpha |
---|
Arguments
- language
\Joomla\Language\Language
Language 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
string
The format string.
Response
string|null
The 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
string
The string to translate.- parameters
array
Array of parameters for the string- jsSafe
bool
True to escape the string for JavaScript output- interpretBackSlashes
bool
To interpret backslashes (\=, \n=carriage return, \t=tabulation)
Response
string
The translated string or the key if $script is true
Properties
language
Language instance
since |
1.0 |
---|
Type(s)
\Joomla\Language\Language