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
*
26
- * <example name="ngMessageFormat-example-gender" module="msgFmtExample" deps="angular-message-format.min. js">
36
+ * <example name="ngMessageFormat-example-gender" module="msgFmtExample" deps="angular-message-format.js">
27
37
* <file name="index.html">
28
38
* <div ng-controller="AppController">
29
39
* Select Recipient:<br>
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.
64
73
*
65
74
* The example also shows the "offset" keyword, which allows you to offset the value of the "#" variable.
66
75
*
67
- * <example name="ngMessageFormat-example-plural" module="msgFmtExample" deps="angular-message-format.min. js">
76
+ * <example name="ngMessageFormat-example-plural" module="msgFmtExample" deps="angular-message-format.js">
68
77
* <file name="index.html">
69
78
* <div ng-controller="AppController">
70
79
Select recipients:<br>
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.
136
- * <example name="ngMessageFormat-example-plural-gender" module="msgFmtExample" deps="angular-message-format.min. js">
144
+ * <example name="ngMessageFormat-example-plural-gender" module="msgFmtExample" deps="angular-message-format.js">
137
145
* <file name="index.html">
138
146
* <div ng-controller="AppController">
139
147
Select recipients:<br>
170
178
* </file>
171
179
</example>
172
180
*/
181
+
173
182
var $$MessageFormatFactory = [ '$parse' , '$locale' , '$sce' , '$exceptionHandler' , function $$messageFormat (
174
183
$parse , $locale , $sce , $exceptionHandler ) {
175
184
@@ -207,15 +216,8 @@ var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpo
207
216
return interpolate ;
208
217
} ] ;
209
218
210
-
211
- /**
212
- * @ngdoc module
213
- * @name ngMessageFormat
214
- * @packageName angular-message-format
215
- * @description
216
- */
217
219
var module = window [ 'angular' ] [ 'module' ] ( 'ngMessageFormat' , [ 'ng' ] ) ;
218
220
module [ 'factory' ] ( '$$messageFormat' , $$MessageFormatFactory ) ;
219
221
module [ 'config' ] ( [ '$provide' , function ( $provide ) {
220
222
$provide [ 'decorator' ] ( '$interpolate' , $$interpolateDecorator ) ;
221
- } ] ) ;
223
+ } ] ) ;
0 commit comments