summaryrefslogtreecommitdiff
path: root/ext/intl/doc/msgfmt_api.php
blob: 3df6f0de11446da935d85d259b97014678085ffb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?php

/**
 * Message formatter class.
 *
 * Message Format provides for runtime formatting of messages in a manner
 * somewhat similar to sprintf. The pattern string has its component parts
 * replaced in a locale-sensitive manner using items in the arguments array.
 *
 * @see http://www.icu-project.org/apiref/icu4c/umsg_8h.html
 *
 */
class MessageFormatter {

	/**
	 * Constructs a new Message Formatter
	 * 
	 * @param  string   $locale  the locale to use when formatting arguments
	 * @param  string   $pattern the pattern string to stick arguments into
	 */
	public function __construct($locale, $pattern) {}

	/**
	 * Constructs a new Message Formatter
	 * 
	 * @param  string   $locale  the locale to use when formatting arguments
	 * @param  string   $pattern the pattern string to stick arguments into
	 */
	public static function create($locale, $pattern) {}

	/**
	 * Format the message
	 * @param   array   $args   arguments to insert into the pattern string
	 * @return  string  the formatted string, or false if an error occurred
	 */
	public function format($args) {}

	/**
	 * Parse input string and returns any extracted items as an array
	 *
	 * $error will contain any error code. If an error occurs, $parse_pos contains
	 * the position of the error.
	 *
	 * @param  string  $value      string to parse for items
	 * @return array               array containing items extracted
	 *
	 */
	public function parse($value) {}

	/**
	 * Inserts the items in $args into $pattern, formatting them
	 * according to $locale. This is the static implementation.
	 *
	 * @param string    $locale   the locale to use when formatting numbers and dates and suchlike
	 * @param string    $pattern  the pattern string to insert things into
	 * @param array     $args     the array of values to insert into $pattern
	 * @return string             the formatted pattern string or false if an error occurred
	 */
	public static function formatMessage($locale, $pattern, $args) {}

	/**
	 * parses input string and returns any extracted items as an array
	 *
	 * $error will contain any error code. If an error occurs, $parse_pos contains
	 * the position of the error.
	 *
	 * @param  string  $locale     the locale to use when formatting numbers and dates and suchlike
	 * @param  string  $value      string to parse for items
	 * @return array               array containing items extracted
	 *
	 */
	public static function parseMessage($locale, $value) {}

	/**
	 * Get the pattern used by the formatter
	 *
	 * @return  string  the pattern string for this message formatter
	 */
	public function getPattern() {}

	/**
	 * Set the pattern used by the formatter
	 *
	 * @param  string  $pattern  the pattern string to use in this message formatter
	 * @return boolean 'true' if successful, 'false' if an error
	 */
	public function setPattern($pattern) {}

	/**
	 * Get the error code from last operation
	 *
	 * Returns error code from the last number formatting operation.
	 *
	 * @return integer the error code, one of UErrorCode values. Initial value is U_ZERO_ERROR.
	 */
	public function getErrorCode() {}
	/**
	 * Get the error text from the last operation.
	 *
	 * @return string Description of the last error.
	 */
	public function getErrorMessage() {}
	/**
	 * Get the locale for which the formatter was created.
	 *
	 * @return string locale name
	 */
	public function getLocale() {}
}

	/** Now the same as procedural API */


	/**
	 * Constructs a new Message Formatter
	 * 
	 * @param  string   $locale  the locale to use when formatting arguments
	 * @param  string   $pattern the pattern string to stick arguments into
	 * @return MessageFormatter formatter object
	 */
	function msgfmt_create($locale, $pattern) {}

	/**
	 * Format the message
	 * @param MessageFormatter $fmt The message formatter 
	 * @param   array   $args   arguments to insert into the pattern string
	 * @return  string  the formatted string, or false if an error occurred
	 */
	function msgfmt_format($fmt, $args) {}

	/**
	 * parses input string and returns any extracted items as an array
	 *
	 * $error will contain any error code. If an error occurs, $parse_pos contains
	 * the position of the error.
	 *
	 * @param MessageFormatter $fmt The message formatter 
	 * @param  string  $value      string to parse for items
	 * @return array               array containing items extracted
	 *
	 */
	function msgfmt_parse($fmt, $value) {}

	/**
	 * Inserts the items in $args into $pattern, formatting them
	 * according to $locale. This is the static implementation.
	 *
	 * @param string    $locale   the locale to use when formatting numbers and dates and suchlike
	 * @param string    $pattern  the pattern string to insert things into
	 * @param array     $args     the array of values to insert into $pattern
	 * @return string             the formatted pattern string or false if an error occurred
	 */
	function msgfmt_format_message($locale, $pattern, $args) {}

	/**
	 * parses input string and returns any extracted items as an array
	 *
	 * $error will contain any error code. If an error occurs, $parse_pos contains
	 * the position of the error.
	 *
	 * @param  string  $locale     the locale to use when formatting numbers and dates and suchlike
	 * @param  string  $value      string to parse for items
	 * @return array               array containing items extracted
	 *
	 */
	function msgfmt_parse_message($locale, $value) {}

	/**
	 * Get the pattern used by the formatter
	 *
	 * @param MessageFormatter $fmt The message formatter 
	 * @return  string  the pattern string for this message formatter
	 */
	function msgfmt_get_pattern($fmt) {}

	/**
	 * Set the pattern used by the formatter
	 *
	 * @param MessageFormatter $fmt The message formatter 
	 * @param  string  $pattern  the pattern string to use in this message formatter
	 * @return boolean 'true' if successful, 'false' if an error
	 */
	function msgfmt_set_pattern($fmt, $pattern) {}

	/**
	 * Get the error code from last operation
	 *
	 * Returns error code from the last number formatting operation.
	 *
	 * @param MessageFormatter $fmt The message formatter 
	 * @return integer the error code, one of UErrorCode values. Initial value is U_ZERO_ERROR.
	 */
	function msgfmt_get_error_code($fmt) {}
	/**
	 * Get the error text from the last operation.
	 *
	 * @param MessageFormatter $fmt The message formatter 
	 * @return string Description of the last error.
	 */
	function msgfmt_get_error_message($fmt) {}

	/**
	 * Get the locale for which the formatter was created.
	 *
	 * @param NumberFormatter $formatter The formatter resource
	 * @return string locale name
	 */
	function msgfmt_get_locale($formatter) {}
?>