Skip to content

Commit

Permalink
added new locale: ku-kmr (Northern Kurdish)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergehez authored and ichernev committed Dec 24, 2023
1 parent 651dff4 commit 89f5e76
Show file tree
Hide file tree
Showing 2 changed files with 686 additions and 0 deletions.
123 changes: 123 additions & 0 deletions src/locale/ku-kmr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
//! moment.js locale configuration
//! locale : Northern Kurdish [ku-kmr]
//! authors : Mazlum Özdogan : https://github.com/mergehez

// All rules except for month names are according to
// the spelling rules which are defined in the book 'Rêbera Rastnivîsînê' from Komxebata Kurmancîyê.
// Komxebata Kurmancîyê is a work group that studied different uses in Kurdish language (Kurmanji/Northern Kurdish),
// chose one of alternatives as standard and publish them via their book.
// There are 18 Kurdish linguists in the group.
// The group was formed by Mesopotamia Foundation

import moment from '../moment';

const processRelativeTime = (num, withoutSuffix, key, isFuture) => {
var format = {
s: ['çend sanîye', 'çend sanîyeyan', 'çend sanîyeyên'],
ss: [num + ' sanîye', num + ' sanîyeyan', 'di '+num+' sanîyeyan de'],
m: ['deqîqeyek', 'deqîqeyekê', 'deqîqeyeke'],
mm: [num + ' deqîqe', num + ' deqîqeyan', 'di '+num+' deqîqeyan de'],
h: ['saetek', 'saetekê', 'saeteke'],
hh: [num + ' saet', num + ' saetan', 'di '+num+' saetan de'],
d: ['rojek', 'rojekê', 'rojeke'],
dd: [num + ' roj', num + ' rojan', 'di '+num+' rojan de'],
w: ['hefteyek', 'hefteyekê', 'hefteyeke'],
ww: [num + ' hefte', num + ' hefteyan', 'di '+num+' hefteyan de'],
M: ['mehek', 'mehekê', 'meheke'],
MM: [num + ' meh', num + ' mehan', 'di '+num+' mehan de'],
y: ['salek', 'salekê', 'saleke'],
yy: [num + ' sal', num + ' salan', 'di '+num+' salan de'],
};
return withoutSuffix ? format[key][0] : format[key][1];
}
// const obliqueNumSuffix = (num) => {
// if(num.includes(':'))
// num = parseInt(num.split(':')[0]);
// else
// num = parseInt(num);
// return num == 0 || num % 10 == 1 ? 'ê'
// : (num > 10 && num % 10 == 0 ? 'î' : 'an');
// }
const ezafeNumSuffix = (num) => {
num = ''+num;
const l = num.substring(num.length - 1),
ll = num.length > 1 ? num.substring(num.length - 2) : '';
if(!(ll == 12 || ll == 13) && (l == '2' || l == '3' || ll == '50' || l == '70' || l == '80'))
return 'yê';
return 'ê';
}

export default moment.defineLocale('ku-kmr', {
// According to the spelling rules defined by the work group of Weqfa Mezopotamyayê (Mesopotamia Foundation)
// 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'
// But the names below are more well known and handy
months: 'Rêbendan_Sibat_Adar_Nîsan_Gulan_Hezîran_Tîrmeh_Tebax_Îlon_Cotmeh_Mijdar_Berfanbar'.split(
'_'
),
monthsShort: 'Rêb_Sib_Ada_Nîs_Gul_Hez_Tîr_Teb_Îlo_Cot_Mij_Ber'.split(
'_'
),
monthsParseExact: true,
weekdays: 'Yekşem_Duşem_Sêşem_Çarşem_Pêncşem_În_Şemî'.split(
'_'
),
weekdaysShort: 'Yek_Du_Sê_Çar_Pên_În_Şem'.split('_'),
weekdaysMin: 'Ye_Du_Sê_Ça_Pê_În_Şe'.split('_'),
meridiem: function (hours, minutes, isLower) {
if (hours < 12) {
return isLower ? 'bn' : 'BN';
} else {
return isLower ? 'pn' : 'PN';
}
},
meridiemParse: /bn|BN|pn|PN/,
longDateFormat: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD.MM.YYYY',
LL: 'Do MMMM[a] YYYY[an]',
LLL: 'Do MMMM[a] YYYY[an] HH:mm',
LLLL: 'dddd, Do MMMM[a] YYYY[an] HH:mm',
ll: 'Do MMM[.] YYYY[an]',
lll: 'Do MMM[.] YYYY[an] HH:mm',
llll: 'ddd[.], Do MMM[.] YYYY[an] HH:mm',
},
calendar: {
sameDay: function (h) { return '[Îro di saet] LT [de]'; },
nextDay: function (h) { return '[Sibê di saet] LT [de]'; },
nextWeek: function (h) { return 'dddd [di saet] LT [de]'; },
lastDay: function () { return '[Duh di saet] LT [de]'; },
lastWeek: function () { return 'dddd[a borî di saet] LT [de]'; },
sameElse: 'L',
},
relativeTime: {
future: 'di %s de',
past: 'berî %s',
s: processRelativeTime,
ss: processRelativeTime,
m: processRelativeTime,
mm: processRelativeTime,
h: processRelativeTime,
hh: processRelativeTime,
d: processRelativeTime,
dd: processRelativeTime,
w: processRelativeTime,
ww: processRelativeTime,
M: processRelativeTime,
MM: processRelativeTime,
y: processRelativeTime,
yy: processRelativeTime
},
dayOfMonthOrdinalParse: /\d{1,2}(?:yê|ê|\.)/,
ordinal: (num, period) => {
let p = period.toLowerCase();
if(p.includes('w') || p.includes('m'))
return num+'.';

return num + ezafeNumSuffix(num);
},
week: {
dow: 1, // Monday is the first day of the week.
doy: 4, // The week that contains Jan 4th is the first week of the year.
},
});
Loading

0 comments on commit 89f5e76

Please sign in to comment.