aboutsummaryrefslogtreecommitdiffstats
path: root/src/service/locale.js
blob: 069a691ed2685425cbe6917c5d2f2d153b6b8113 (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
'use strict';

/**
 * @ngdoc service
 * @name angular.service.$locale
 *
 * @description
 * $locale service provides localization rules for various Angular components. As of right now the
 * only public api is:
 *
 * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
 */
angularServiceInject('$locale', function() {
  return {
    id: 'en-us',

    NUMBER_FORMATS: {
      DECIMAL_SEP: '.',
      GROUP_SEP: ',',
      PATTERNS: [
        { // Decimal Pattern
          minInt: 1,
          minFrac: 0,
          maxFrac: 3,
          posPre: '',
          posSuf: '',
          negPre: '-',
          negSuf: '',
          gSize: 3,
          lgSize: 3
        },{ //Currency Pattern
          minInt: 1,
          minFrac: 2,
          maxFrac: 2,
          posPre: '\u00A4',
          posSuf: '',
          negPre: '(\u00A4',
          negSuf: ')',
          gSize: 3,
          lgSize: 3
        }
      ],
      CURRENCY_SYM: '$'
    },

    DATETIME_FORMATS: {
      MONTH: 'January,February,March,April,May,June,July,August,September,October,November,December'
              .split(','),
      SHORTMONTH:  'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),
      DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),
      SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','),
      AMPMS: ['AM','PM'],
      medium: 'MMM d, y h:mm:ss a',
      short: 'M/d/yy h:mm a',
      fullDate: 'EEEE, MMMM d, y',
      longDate: 'MMMM d, y',
      mediumDate: 'MMM d, y',
      shortDate: 'M/d/yy',
      mediumTime: 'h:mm:ss a',
      shortTime: 'h:mm a'
    },

    pluralCat: function(num) {
      if (num === 1) {
        return 'one';
      }
      return 'other';
    }
  };
});