Class JText

Description

Text handling class.

  • since: 11.1

Located in /libraries/joomla/language/text.php (line 19)


	
			
Variable Summary
 static array $strings
Method Summary
 static string alt (string $string, string $alt, [mixed $jsSafe = false], [boolean $interpretBackSlashes = true], [boolean $script = false])
 static string plural (string $string, integer $n)
 static mixed printf (format $string)
 static string script ([string $string = null], [boolean $jsSafe = false], [boolean $interpretBackSlashes = true])
 static string sprintf (string $string)
 static string _ (string $string, [mixed $jsSafe = false], [boolean $interpretBackSlashes = true], [boolean $script = false])
Variables
static array $strings = array() (line 27)

javascript strings

  • since: 11.1
  • access: protected
Methods
static alt (line 127)

Translates a string into the current language.

Examples: <?php echo JText::alt("JALL","language");?> it will generate a 'All' string in English but a "Toutes" string in French <?php echo JText::alt("JALL","module");?> it will generate a 'All' string in English but a "Tous" string in French

  • return: The translated string or the key if $script is true
  • since: 11.1
  • access: public
static string alt (string $string, string $alt, [mixed $jsSafe = false], [boolean $interpretBackSlashes = true], [boolean $script = false])
  • string $string: The string to translate.
  • string $alt: The alternate option for global string
  • mixed $jsSafe: Boolean: Make the result javascript safe.
  • boolean $interpretBackSlashes: To interpret backslashes (\\=\, \n=carriage return, \t=tabulation)
  • boolean $script: To indicate that the string will be pushed in the javascript language store
static plural (line 168)

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

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._('<?php echo JText::plural("COM_PLUGINS_N_ITEMS_UNPUBLISHED", 1, array("script"=>true));?>'));</script> will generate an alert message containing '1 plugin successfully disabled' <?php echo JText::plural("COM_PLUGINS_N_ITEMS_UNPUBLISHED", 1);?> it will generate a '1 plugin successfully disabled' string

  • return: The translated strings or the key if 'script' is true in the array of options
  • since: 11.1
  • access: public
static string plural (string $string, integer $n)
  • string $string: The format string.
  • integer $n: The number of items
static printf (line 297)

Passes a string thru an printf.

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

  • since: 11.1
  • access: public
static mixed printf (format $string)
  • format $string: The format string.
static script (line 334)

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

  • since: 11.1
  • access: public
static string script ([string $string = null], [boolean $jsSafe = false], [boolean $interpretBackSlashes = true])
  • string $string: The JText key.
  • boolean $jsSafe: Ensure the output is JavaScript safe.
  • boolean $interpretBackSlashes: Interpret \t and \n.
static sprintf (line 251)

Passes a string thru a sprintf.

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.

  • return: The translated strings or the key if 'script' is true in the array of options.
  • since: 11.1
  • access: public
static string sprintf (string $string)
  • string $string: The format string.
static _ (line 46)

Translates a string into the current language.

Examples: <script>alert(Joomla.JText._('<?php echo JText::_("JDEFAULT", array("script"=>true));?>'));</script> will generate an alert message containing 'Default' <?php echo JText::_("JDEFAULT");?> it will generate a 'Default' string

  • return: The translated string or the key is $script is true
  • since: 11.1
  • access: public
static string _ (string $string, [mixed $jsSafe = false], [boolean $interpretBackSlashes = true], [boolean $script = false])
  • string $string: The string to translate.
  • mixed $jsSafe: Boolean: Make the result javascript safe.
  • boolean $interpretBackSlashes: To interpret backslashes (\\=\, \n=carriage return, \t=tabulation)
  • boolean $script: To indicate that the string will be push in the javascript language store

Documentation generated on Tue, 19 Nov 2013 15:15:41 +0100 by phpDocumentor 1.4.3