1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Language
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Wrapper class for JText
14 *
15 * @package Joomla.Platform
16 * @subpackage Language
17 * @since 3.4
18 */
19 class JLanguageWrapperText
20 {
21 /**
22 * Helper wrapper method for _
23 *
24 * @param string $string The string to translate.
25 * @param mixed $jsSafe Boolean: Make the result javascript safe.
26 * @param boolean $interpretBackSlashes To interpret backslashes (\\=\, \n=carriage return, \t=tabulation).
27 * @param boolean $script To indicate that the string will be push in the javascript language store.
28 *
29 * @return string The translated string or the key if $script is true.
30 *
31 * @see JText::_
32 * @since 3.4
33 */
34 public function _($string, $jsSafe = false, $interpretBackSlashes = true, $script = false)
35 {
36 return JText::_($string, $jsSafe, $interpretBackSlashes, $script);
37 }
38
39 /**
40 * Helper wrapper method for alt
41 *
42 * @param string $string The string to translate.
43 * @param string $alt The alternate option for global string.
44 * @param mixed $jsSafe Boolean: Make the result javascript safe.
45 * @param boolean $interpretBackSlashes To interpret backslashes (\\=\, \n=carriage return, \t=tabulation).
46 * @param boolean $script To indicate that the string will be pushed in the javascript language store.
47 *
48 * @return string The translated string or the key if $script is true.
49 *
50 * @see JText::alt
51 * @since 3.4
52 */
53 public function alt($string, $alt, $jsSafe = false, $interpretBackSlashes = true, $script = false)
54 {
55 return JText::alt($string, $alt, $jsSafe, $interpretBackSlashes, $script);
56 }
57
58 /**
59 * Helper wrapper method for plural
60 *
61 * @param string $string The format string.
62 * @param integer $n The number of items.
63 *
64 * @return string The translated strings or the key if 'script' is true in the array of options.
65 *
66 * @see JText::plural
67 * @since 3.4
68 */
69 public function plural($string, $n)
70 {
71 return JText::plural($string, $n);
72 }
73
74 /**
75 * Helper wrapper method for sprintf
76 *
77 * @param string $string The format string.
78 *
79 * @return string The translated strings or the key if 'script' is true in the array of options.
80 *
81 * @see JText::sprintf
82 * @since 3.4
83 */
84 public function sprintf($string)
85 {
86 return JText::sprintf($string);
87 }
88
89 /**
90 * Helper wrapper method for printf
91 *
92 * @param format $string The format string.
93 *
94 * @return mixed
95 *
96 * @see JText::printf
97 * @since 3.4
98 */
99 public function printf($string)
100 {
101 return JText::printf($string);
102 }
103
104 /**
105 * Helper wrapper method for script
106 *
107 * @param string $string The JText key.
108 * @param boolean $jsSafe Ensure the output is JavaScript safe.
109 * @param boolean $interpretBackSlashes Interpret \t and \n.
110 *
111 * @return string
112 *
113 * @see JText::script
114 * @since 3.4
115 */
116 public function script($string = null, $jsSafe = false, $interpretBackSlashes = true)
117 {
118 return JText::script($string, $jsSafe, $interpretBackSlashes);
119 }
120 }
121