10
10
/* global stringify: false */
11
11
12
12
/**
13
- * @ngdoc service
14
- * @name $$messageFormat
13
+ * @ngdoc module
14
+ * @name ngMessageFormat
15
+ * @packageName angular-message-format
15
16
*
16
17
* @description
17
- * Angular internal service to recognize MessageFormat extensions in interpolation expressions.
18
- * For more information, see:
19
- * https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit
20
18
*
21
- * @example
22
- * ## Gender
19
+ * ## What is ngMessageFormat?
20
+ *
21
+ * The ngMessageFormat module extends the Angular {@link ng.$interpolate `$interpolate`} service
22
+ * with a syntax for handling pluralization and gender specific messages, which is based on the
23
+ * [ICU MessageFormat syntax][ICU].
24
+ *
25
+ * See [the design doc][ngMessageFormat doc] for more information.
26
+ *
27
+ * [ICU]: http://userguide.icu-project.org/formatparse/messages#TOC-MessageFormat
28
+ * [ngMessageFormat doc]: https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit
29
+ *
30
+ * ## Examples
31
+ *
32
+ * ### Gender
23
33
*
24
34
* This example uses the "select" keyword to specify the message based on gender.
25
35
*
54
64
* </file>
55
65
* </example>
56
66
*
57
- * @example
58
- * ## Plural
67
+ * ### Plural
59
68
*
60
69
* This example shows how the "plural" keyword is used to account for a variable number of entities.
61
70
* The "#" variable holds the current number and can be embedded in the message.
128
137
* </file>
129
138
* </example>
130
139
*
131
- * @example
132
- * ## Plural and Gender
140
+ * ### Plural and Gender together
133
141
*
134
142
* This example shows how you can specify gender rules for specific plural matches - in this case,
135
143
* =1 is special cased for gender.
170
178
* </file>
171
179
</example>
172
180
*/
181
+ var module = window [ 'angular' ] [ 'module' ] ( 'ngMessageFormat' , [ 'ng' ] ) ;
182
+ module [ 'factory' ] ( '$$messageFormat' , $$MessageFormatFactory ) ;
183
+ module [ 'config' ] ( [ '$provide' , function ( $provide ) {
184
+ $provide [ 'decorator' ] ( '$interpolate' , $$interpolateDecorator ) ;
185
+ } ] ) ;
186
+
173
187
var $$MessageFormatFactory = [ '$parse' , '$locale' , '$sce' , '$exceptionHandler' , function $$messageFormat (
174
188
$parse , $locale , $sce , $exceptionHandler ) {
175
189
@@ -205,17 +219,4 @@ var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpo
205
219
interpolate [ 'startSymbol' ] = $interpolate [ 'startSymbol' ] ;
206
220
interpolate [ 'endSymbol' ] = $interpolate [ 'endSymbol' ] ;
207
221
return interpolate ;
208
- } ] ;
209
-
210
-
211
- /**
212
- * @ngdoc module
213
- * @name ngMessageFormat
214
- * @packageName angular-message-format
215
- * @description
216
- */
217
- var module = window [ 'angular' ] [ 'module' ] ( 'ngMessageFormat' , [ 'ng' ] ) ;
218
- module [ 'factory' ] ( '$$messageFormat' , $$MessageFormatFactory ) ;
219
- module [ 'config' ] ( [ '$provide' , function ( $provide ) {
220
- $provide [ 'decorator' ] ( '$interpolate' , $$interpolateDecorator ) ;
221
- } ] ) ;
222
+ } ] ;
0 commit comments