[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/resources/lib/moment/locale/ -> uk.js (source)

   1  // moment.js locale configuration
   2  // locale : ukrainian (uk)
   3  // author : zemlanin : https://github.com/zemlanin
   4  // Author : Menelion Elensúle : https://github.com/Oire
   5  
   6  (function (factory) {
   7      if (typeof define === 'function' && define.amd) {
   8          define(['moment'], factory); // AMD
   9      } else if (typeof exports === 'object') {
  10          module.exports = factory(require('../moment')); // Node
  11      } else {
  12          factory(window.moment); // Browser global
  13      }
  14  }(function (moment) {
  15      function plural(word, num) {
  16          var forms = word.split('_');
  17          return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
  18      }
  19  
  20      function relativeTimeWithPlural(number, withoutSuffix, key) {
  21          var format = {
  22              'mm': 'хвилина_хвилини_хвилин',
  23              'hh': 'година_години_годин',
  24              'dd': 'день_дні_днів',
  25              'MM': 'місяць_місяці_місяців',
  26              'yy': 'рік_роки_років'
  27          };
  28          if (key === 'm') {
  29              return withoutSuffix ? 'хвилина' : 'хвилину';
  30          }
  31          else if (key === 'h') {
  32              return withoutSuffix ? 'година' : 'годину';
  33          }
  34          else {
  35              return number + ' ' + plural(format[key], +number);
  36          }
  37      }
  38  
  39      function monthsCaseReplace(m, format) {
  40          var months = {
  41              'nominative': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_'),
  42              'accusative': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_')
  43          },
  44  
  45          nounCase = (/D[oD]? *MMMM?/).test(format) ?
  46              'accusative' :
  47              'nominative';
  48  
  49          return months[nounCase][m.month()];
  50      }
  51  
  52      function weekdaysCaseReplace(m, format) {
  53          var weekdays = {
  54              'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'),
  55              'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'),
  56              'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_')
  57          },
  58  
  59          nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ?
  60              'accusative' :
  61              ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ?
  62                  'genitive' :
  63                  'nominative');
  64  
  65          return weekdays[nounCase][m.day()];
  66      }
  67  
  68      function processHoursFunction(str) {
  69          return function () {
  70              return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT';
  71          };
  72      }
  73  
  74      return moment.defineLocale('uk', {
  75          months : monthsCaseReplace,
  76          monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'),
  77          weekdays : weekdaysCaseReplace,
  78          weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
  79          weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
  80          longDateFormat : {
  81              LT : 'HH:mm',
  82              L : 'DD.MM.YYYY',
  83              LL : 'D MMMM YYYY р.',
  84              LLL : 'D MMMM YYYY р., LT',
  85              LLLL : 'dddd, D MMMM YYYY р., LT'
  86          },
  87          calendar : {
  88              sameDay: processHoursFunction('[Сьогодні '),
  89              nextDay: processHoursFunction('[Завтра '),
  90              lastDay: processHoursFunction('[Вчора '),
  91              nextWeek: processHoursFunction('[У] dddd ['),
  92              lastWeek: function () {
  93                  switch (this.day()) {
  94                  case 0:
  95                  case 3:
  96                  case 5:
  97                  case 6:
  98                      return processHoursFunction('[Минулої] dddd [').call(this);
  99                  case 1:
 100                  case 2:
 101                  case 4:
 102                      return processHoursFunction('[Минулого] dddd [').call(this);
 103                  }
 104              },
 105              sameElse: 'L'
 106          },
 107          relativeTime : {
 108              future : 'за %s',
 109              past : '%s тому',
 110              s : 'декілька секунд',
 111              m : relativeTimeWithPlural,
 112              mm : relativeTimeWithPlural,
 113              h : 'годину',
 114              hh : relativeTimeWithPlural,
 115              d : 'день',
 116              dd : relativeTimeWithPlural,
 117              M : 'місяць',
 118              MM : relativeTimeWithPlural,
 119              y : 'рік',
 120              yy : relativeTimeWithPlural
 121          },
 122  
 123          // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason
 124  
 125          meridiem : function (hour, minute, isLower) {
 126              if (hour < 4) {
 127                  return 'ночі';
 128              } else if (hour < 12) {
 129                  return 'ранку';
 130              } else if (hour < 17) {
 131                  return 'дня';
 132              } else {
 133                  return 'вечора';
 134              }
 135          },
 136  
 137          ordinal: function (number, period) {
 138              switch (period) {
 139              case 'M':
 140              case 'd':
 141              case 'DDD':
 142              case 'w':
 143              case 'W':
 144                  return number + '-й';
 145              case 'D':
 146                  return number + '-го';
 147              default:
 148                  return number;
 149              }
 150          },
 151  
 152          week : {
 153              dow : 1, // Monday is the first day of the week.
 154              doy : 7  // The week that contains Jan 1st is the first week of the year.
 155          }
 156      });
 157  }));


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1