forked from rubenv/angular-gettext
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
52 lines (52 loc) · 1.47 KB
/
index.js
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
/**
* @ngdoc module
* @name gettext
* @module gettext
* @packageName angular-gettext
* @description Super simple Gettext for Angular.JS
*
* A sample application can be found at https://github.com/rubenv/angular-gettext-example.
* This is an adaptation of the [TodoMVC](http://todomvc.com/) example. You can use this as a guideline while adding {@link module:gettext angular-gettext} to your own application.
*/
/**
* @ngdoc factory
* @module gettext
* @name gettextPlurals
* @param {String} [langCode=en] language code
* @param {Number} [n=0] number to calculate form for
* @returns {Number} plural form number
* @description Provides correct plural form id for the given language
*
* Example
* ```js
* gettextPlurals('ru', 10); // 1
* gettextPlurals('en', 1); // 0
* gettextPlurals(); // 1
* ```
*/
angular.module('gettext', []);
/**
* @ngdoc object
* @module gettext
* @name gettext
* @kind function
* @param {String} str annotation key
* @description Gettext constant function for annotating strings
*
* ```js
* angular.module('myApp', ['gettext']).config(function(gettext) {
* /// MyApp document title
* gettext('my-app.title');
* ...
* })
* ```
*/
angular.module('gettext').constant('gettext', function (str) {
/*
* Does nothing, simply returns the input string.
*
* This function serves as a marker for `grunt-angular-gettext` to know that
* this string should be extracted for translations.
*/
return str;
});