ku-kmr.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //! moment.js locale configuration
  2. //! locale : Northern Kurdish [ku-kmr]
  3. //! authors : Mazlum Özdogan : https://github.com/mergehez
  4. // All rules except for month names are according to
  5. // the spelling rules which are defined in the book 'Rêbera Rastnivîsînê' from Komxebata Kurmancîyê.
  6. // Komxebata Kurmancîyê is a work group that studied different uses in Kurdish language (Kurmanji/Northern Kurdish),
  7. // chose one of alternatives as standard and publish them via their book.
  8. // There are 18 Kurdish linguists in the group.
  9. // The group was formed by Mesopotamia Foundation
  10. import moment from '../moment';
  11. function processRelativeTime(num, withoutSuffix, key, isFuture) {
  12. var format = {
  13. s: ['çend sanîye', 'çend sanîyeyan'],
  14. ss: [num + ' sanîye', num + ' sanîyeyan'],
  15. m: ['deqîqeyek', 'deqîqeyekê'],
  16. mm: [num + ' deqîqe', num + ' deqîqeyan'],
  17. h: ['saetek', 'saetekê'],
  18. hh: [num + ' saet', num + ' saetan'],
  19. d: ['rojek', 'rojekê'],
  20. dd: [num + ' roj', num + ' rojan'],
  21. w: ['hefteyek', 'hefteyekê'],
  22. ww: [num + ' hefte', num + ' hefteyan'],
  23. M: ['mehek', 'mehekê'],
  24. MM: [num + ' meh', num + ' mehan'],
  25. y: ['salek', 'salekê'],
  26. yy: [num + ' sal', num + ' salan'],
  27. };
  28. return withoutSuffix ? format[key][0] : format[key][1];
  29. }
  30. // function obliqueNumSuffix(num) {
  31. // if(num.includes(':'))
  32. // num = parseInt(num.split(':')[0]);
  33. // else
  34. // num = parseInt(num);
  35. // return num == 0 || num % 10 == 1 ? 'ê'
  36. // : (num > 10 && num % 10 == 0 ? 'î' : 'an');
  37. // }
  38. function ezafeNumSuffix(num) {
  39. num = '' + num;
  40. var l = num.substring(num.length - 1),
  41. ll = num.length > 1 ? num.substring(num.length - 2) : '';
  42. if (
  43. !(ll == 12 || ll == 13) &&
  44. (l == '2' || l == '3' || ll == '50' || l == '70' || l == '80')
  45. )
  46. return 'yê';
  47. return 'ê';
  48. }
  49. export default moment.defineLocale('ku-kmr', {
  50. // According to the spelling rules defined by the work group of Weqfa Mezopotamyayê (Mesopotamia Foundation)
  51. // this should be: 'Kanûna Paşîn_Sibat_Adar_Nîsan_Gulan_Hezîran_Tîrmeh_Tebax_Îlon_Çirîya Pêşîn_Çirîya Paşîn_Kanûna Pêşîn'
  52. // But the names below are more well known and handy
  53. months: 'Rêbendan_Sibat_Adar_Nîsan_Gulan_Hezîran_Tîrmeh_Tebax_Îlon_Cotmeh_Mijdar_Berfanbar'.split(
  54. '_'
  55. ),
  56. monthsShort: 'Rêb_Sib_Ada_Nîs_Gul_Hez_Tîr_Teb_Îlo_Cot_Mij_Ber'.split('_'),
  57. monthsParseExact: true,
  58. weekdays: 'Yekşem_Duşem_Sêşem_Çarşem_Pêncşem_În_Şemî'.split('_'),
  59. weekdaysShort: 'Yek_Du_Sê_Çar_Pên_În_Şem'.split('_'),
  60. weekdaysMin: 'Ye_Du_Sê_Ça_Pê_În_Şe'.split('_'),
  61. meridiem: function (hours, minutes, isLower) {
  62. if (hours < 12) {
  63. return isLower ? 'bn' : 'BN';
  64. } else {
  65. return isLower ? 'pn' : 'PN';
  66. }
  67. },
  68. meridiemParse: /bn|BN|pn|PN/,
  69. longDateFormat: {
  70. LT: 'HH:mm',
  71. LTS: 'HH:mm:ss',
  72. L: 'DD.MM.YYYY',
  73. LL: 'Do MMMM[a] YYYY[an]',
  74. LLL: 'Do MMMM[a] YYYY[an] HH:mm',
  75. LLLL: 'dddd, Do MMMM[a] YYYY[an] HH:mm',
  76. ll: 'Do MMM[.] YYYY[an]',
  77. lll: 'Do MMM[.] YYYY[an] HH:mm',
  78. llll: 'ddd[.], Do MMM[.] YYYY[an] HH:mm',
  79. },
  80. calendar: {
  81. sameDay: '[Îro di saet] LT [de]',
  82. nextDay: '[Sibê di saet] LT [de]',
  83. nextWeek: 'dddd [di saet] LT [de]',
  84. lastDay: '[Duh di saet] LT [de]',
  85. lastWeek: 'dddd[a borî di saet] LT [de]',
  86. sameElse: 'L',
  87. },
  88. relativeTime: {
  89. future: 'di %s de',
  90. past: 'berî %s',
  91. s: processRelativeTime,
  92. ss: processRelativeTime,
  93. m: processRelativeTime,
  94. mm: processRelativeTime,
  95. h: processRelativeTime,
  96. hh: processRelativeTime,
  97. d: processRelativeTime,
  98. dd: processRelativeTime,
  99. w: processRelativeTime,
  100. ww: processRelativeTime,
  101. M: processRelativeTime,
  102. MM: processRelativeTime,
  103. y: processRelativeTime,
  104. yy: processRelativeTime,
  105. },
  106. dayOfMonthOrdinalParse: /\d{1,2}(?:yê|ê|\.)/,
  107. ordinal: function (num, period) {
  108. var p = period.toLowerCase();
  109. if (p.includes('w') || p.includes('m')) return num + '.';
  110. return num + ezafeNumSuffix(num);
  111. },
  112. week: {
  113. dow: 1, // Monday is the first day of the week.
  114. doy: 4, // The week that contains Jan 4th is the first week of the year.
  115. },
  116. });