diff --git a/__tests__/helper.spec.js b/__tests__/helper.spec.js index f79991e..b545e7e 100644 --- a/__tests__/helper.spec.js +++ b/__tests__/helper.spec.js @@ -27,8 +27,8 @@ describe('helper', () => { test('diffSec', () => { const now = new Date(); - expect(diffSec(now)).toEqual(0); - expect(diffSec(now - 10000, now)).toEqual(10); + expect(diffSec(now)).toBeApproximate(0); + expect(diffSec(now - 10000, now)).toBeApproximate(10); }); test('nextInterval', () => { diff --git a/__tests__/locales.spec.js b/__tests__/locales.spec.js index 37fe50b..54d825d 100644 --- a/__tests__/locales.spec.js +++ b/__tests__/locales.spec.js @@ -61,7 +61,8 @@ describe('locales', () => { }); test('register', () => { - register('fr', () => {}); + register('fr', () => 'test'); expect(Locales).toContainKey('fr'); + expect(Locales.fr()).toBe('test'); }); }); diff --git a/demo/index.html b/demo/index.html index 2f0170f..25d31eb 100644 --- a/demo/index.html +++ b/demo/index.html @@ -55,6 +55,13 @@

Test for Jquery DOM ?

You opened this page .

+ +

Test for Locales ?

+

+ You opened this page . + + +

+ diff --git a/demo/index.js b/demo/index.js index 99245e8..5d5cabd 100644 --- a/demo/index.js +++ b/demo/index.js @@ -21,5 +21,6 @@ function init_index_page() { function init_test_page() { $('.native time').attr('datetime', iso8601(new Date())); $('.jquery time').attr('data-timeago', iso8601(new Date())); + $('.locales time').attr('data-timeago', iso8601(new Date())); } diff --git a/dist/timeago.locales.min.js b/dist/timeago.locales.min.js new file mode 100644 index 0000000..ab56584 --- /dev/null +++ b/dist/timeago.locales.min.js @@ -0,0 +1 @@ +!function(){"use strict";var s=[["ثانية","ثانيتين","%s ثوان","%s ثانية"],["دقيقة","دقيقتين","%s دقائق","%s دقيقة"],["ساعة","ساعتين","%s ساعات","%s ساعة"],["يوم","يومين","%s أيام","%s يوماً"],["أسبوع","أسبوعين","%s أسابيع","%s أسبوعاً"],["شهر","شهرين","%s أشهر","%s شهراً"],["عام","عامين","%s أعوام","%s عاماً"]];var n=o.bind(null,"секунду","%s секунду","%s секунды","%s секунд"),e=o.bind(null,"хвіліну","%s хвіліну","%s хвіліны","%s хвілін"),a=o.bind(null,"гадзіну","%s гадзіну","%s гадзіны","%s гадзін"),u=o.bind(null,"дзень","%s дзень","%s дні","%s дзён"),t=o.bind(null,"тыдзень","%s тыдзень","%s тыдні","%s тыдняў"),i=o.bind(null,"месяц","%s месяц","%s месяцы","%s месяцаў"),r=o.bind(null,"год","%s год","%s гады","%s гадоў");function o(s,n,e,a,u){var t=u%10,i=a;return 1===u?i=s:1===t&&u>20?i=n:t>1&&t<5&&(u>20||u<10)&&(i=e),i}var m=[["w tej chwili","za chwilę"],["%s sekund temu","za %s sekund"],["1 minutę temu","za 1 minutę"],["%s minut temu","za %s minut"],["1 godzinę temu","za 1 godzinę"],["%s godzin temu","za %s godzin"],["1 dzień temu","za 1 dzień"],["%s dni temu","za %s dni"],["1 tydzień temu","za 1 tydzień"],["%s tygodni temu","za %s tygodni"],["1 miesiąc temu","za 1 miesiąc"],["%s miesięcy temu","za %s miesięcy"],["1 rok temu","za 1 rok"],["%s lat temu","za %s lat"],["%s sekundy temu","za %s sekundy"],["%s minuty temu","za %s minuty"],["%s godziny temu","za %s godziny"],["%s dni temu","za %s dni"],["%s tygodnie temu","za %s tygodnie"],["%s miesiące temu","za %s miesiące"],["%s lata temu","za %s lata"]];var d=b.bind(null,"секунду","%s секунду","%s секунды","%s секунд"),l=b.bind(null,"минуту","%s минуту","%s минуты","%s минут"),c=b.bind(null,"час","%s час","%s часа","%s часов"),g=b.bind(null,"день","%s день","%s дня","%s дней"),h=b.bind(null,"неделю","%s неделю","%s недели","%s недель"),p=b.bind(null,"месяц","%s месяц","%s месяца","%s месяцев"),f=b.bind(null,"год","%s год","%s года","%s лет");function b(s,n,e,a,u){var t=u%10,i=a;return 1===u?i=s:1===t&&u>20?i=n:t>1&&t<5&&(u>20||u<10)&&(i=e),i}var y=M.bind(null,"1 секунд","%s секунд","%s секунде","%s секунди"),k=M.bind(null,"1 минут","%s минут","%s минуте","%s минута"),v=M.bind(null,"сат времена","%s сат","%s сата","%s сати"),j=M.bind(null,"1 дан","%s дан","%s дана","%s дана"),z=M.bind(null,"недељу дана","%s недељу","%s недеље","%s недеља"),w=M.bind(null,"месец дана","%s месец","%s месеца","%s месеци"),q=M.bind(null,"годину дана","%s годину","%s године","%s година");function M(s,n,e,a,u){var t=u%10,i=u%100;return 1==u?s:1==t&&11!=i?n:t>=2&&t<=4&&!(i>=12&&i<=14)?e:a}var _=O.bind(null,"секунду","%s секунду","%s секунди","%s секунд"),S=O.bind(null,"хвилину","%s хвилину","%s хвилини","%s хвилин"),W=O.bind(null,"годину","%s годину","%s години","%s годин"),T=O.bind(null,"день","%s день","%s дні","%s днів"),J=O.bind(null,"тиждень","%s тиждень","%s тиждні","%s тижднів"),x=O.bind(null,"місяць","%s місяць","%s місяці","%s місяців"),N=O.bind(null,"рік","%s рік","%s роки","%s років");function O(s,n,e,a,u){var t=u%10,i=a;return 1===u?i=s:1===t&&u>20?i=n:t>1&&t<5&&(u>20||u<10)&&(i=e),i}var B={ar:function(n,e){if(0===e)return["منذ لحظات","بعد لحظات"];var a,u,t=(a=Math.floor(e/2),(u=n)<3?s[a][u-1]:u>=3&&u<=10?s[a][2]:s[a][3]);return["منذ "+t,"بعد "+t]},be:function(s,o){switch(o){case 0:return["толькі што","праз некалькі секунд"];case 1:return[n(s)+" таму","праз "+n(s)];case 2:case 3:return[e(s)+" таму","праз "+e(s)];case 4:case 5:return[a(s)+" таму","праз "+a(s)];case 6:case 7:return[u(s)+" таму","праз "+u(s)];case 8:case 9:return[t(s)+" таму","праз "+t(s)];case 10:case 11:return[i(s)+" таму","праз "+i(s)];case 12:case 13:return[r(s)+" таму","праз "+r(s)];default:return["",""]}},bg:function(s,n){return[["току що","съвсем скоро"],["преди %s секунди","след %s секунди"],["преди 1 минута","след 1 минута"],["преди %s минути","след %s минути"],["преди 1 час","след 1 час"],["преди %s часа","след %s часа"],["преди 1 ден","след 1 ден"],["преди %s дни","след %s дни"],["преди 1 седмица","след 1 седмица"],["преди %s седмици","след %s седмици"],["преди 1 месец","след 1 месец"],["преди %s месеца","след %s месеца"],["преди 1 година","след 1 година"],["преди %s години","след %s години"]][n]},ca:function(s,n){return[["fa un moment","d'aquí un moment"],["fa %s segons","d'aquí %s segons"],["fa 1 minut","d'aquí 1 minut"],["fa %s minuts","d'aquí %s minuts"],["fa 1 hora","d'aquí 1 hora"],["fa %s hores","d'aquí %s hores"],["fa 1 dia","d'aquí 1 dia"],["fa %s dies","d'aquí %s dies"],["fa 1 setmana","d'aquí 1 setmana"],["fa %s setmanes","d'aquí %s setmanes"],["fa 1 mes","d'aquí 1 mes"],["fa %s mesos","d'aquí %s mesos"],["fa 1 any","d'aquí 1 any"],["fa %s anys","d'aquí %s anys"]][n]},de:function(s,n){return[["gerade eben","vor einer Weile"],["vor %s Sekunden","in %s Sekunden"],["vor 1 Minute","in 1 Minute"],["vor %s Minuten","in %s Minuten"],["vor 1 Stunde","in 1 Stunde"],["vor %s Stunden","in %s Stunden"],["vor 1 Tag","in 1 Tag"],["vor %s Tagen","in %s Tagen"],["vor 1 Woche","in 1 Woche"],["vor %s Wochen","in %s Wochen"],["vor 1 Monat","in 1 Monat"],["vor %s Monaten","in %s Monaten"],["vor 1 Jahr","in 1 Jahr"],["vor %s Jahren","in %s Jahren"]][n]},el:function(s,n){return[["μόλις τώρα","σε λίγο"],["%s δευτερόλεπτα πριν","σε %s δευτερόλεπτα"],["1 λεπτό πριν","σε 1 λεπτό"],["%s λεπτά πριν","σε %s λεπτά"],["1 ώρα πριν","σε 1 ώρα"],["%s ώρες πριν","σε %s ώρες"],["1 μέρα πριν","σε 1 μέρα"],["%s μέρες πριν","σε %s μέρες"],["1 εβδομάδα πριν","σε 1 εβδομάδα"],["%s εβδομάδες πριν","σε %s εβδομάδες"],["1 μήνα πριν","σε 1 μήνα"],["%s μήνες πριν","σε %s μήνες"],["1 χρόνο πριν","σε 1 χρόνο"],["%s χρόνια πριν","σε %s χρόνια"]][n]},en:function(s,n){return[["just now","right now"],["%s seconds ago","in %s seconds"],["1 minute ago","in 1 minute"],["%s minutes ago","in %s minutes"],["1 hour ago","in 1 hour"],["%s hours ago","in %s hours"],["1 day ago","in 1 day"],["%s days ago","in %s days"],["1 week ago","in 1 week"],["%s weeks ago","in %s weeks"],["1 month ago","in 1 month"],["%s months ago","in %s months"],["1 year ago","in 1 year"],["%s years ago","in %s years"]][n]},en_short:function(s,n){return[["just now","right now"],["%ss ago","in %ss"],["1m ago","in 1m"],["%sm ago","in %sm"],["1h ago","in 1h"],["%sh ago","in %sh"],["1d ago","in 1d"],["%sd ago","in %sd"],["1w ago","in 1w"],["%sw ago","in %sw"],["1mo ago","in 1mo"],["%smo ago","in %smo"],["1yr ago","in 1yr"],["%syr ago","in %syr"]][n]},es:function(s,n){return[["justo ahora","en un rato"],["hace %s segundos","en %s segundos"],["hace 1 minuto","en 1 minuto"],["hace %s minutos","en %s minutos"],["hace 1 hora","en 1 hora"],["hace %s horas","en %s horas"],["hace 1 día","en 1 día"],["hace %s días","en %s días"],["hace 1 semana","en 1 semana"],["hace %s semanas","en %s semanas"],["hace 1 mes","en 1 mes"],["hace %s meses","en %s meses"],["hace 1 año","en 1 año"],["hace %s años","en %s años"]][n]},eu:function(s,n){return[["orain","denbora bat barru"],["duela %s segundu","%s segundu barru"],["duela minutu 1","minutu 1 barru"],["duela %s minutu","%s minutu barru"],["duela ordu 1","ordu 1 barru"],["duela %s ordu","%s ordu barru"],["duela egun 1","egun 1 barru"],["duela %s egun","%s egun barru"],["duela aste 1","aste 1 barru"],["duela %s aste","%s aste barru"],["duela hillabete 1","hillabete 1 barru"],["duela %s hillabete","%s hillabete barru"],["duela urte 1","urte 1 barru"],["duela %s urte","%s urte barru"]][n]},fa:function(s,n){return[["همین الآن","لحظاتی پیش"],["%s ثانیه پیش","حدود %s ثانیه پیش"],["1 دقیقه پیش","حدود 1 دقیقه پیش"],["%s دقیقه پیش","حدود %s دقیقه پیش"],["1 ساعت پیش","حدود 1 ساعت پیش"],["%s ساعت پیش","حدود %s ساعت پیش"],["1 روز پیش","حدود 1 روز پیش"],["%s روز پیش","حدود %s روز پیش"],["1 هفته پیش","حدود 1 هفته پیش"],["%s هفته پیش","حدود %s هفته پیش"],["1 ماه پیش","حدود 1 ماه پیش"],["%s ماه پیش","حدود %s ماه پیش"],["1 سال پیش","حدود 1 سال پیش"],["%s سال پیش","حدود %s سال پیش"]][n]},fi:function(s,n){return[["juuri äsken","juuri nyt"],["%s sekuntia sitten","%s sekunnin päästä"],["minuutti sitten","minuutin päästä"],["%s minuuttia sitten","%s minuutin päästä"],["tunti sitten","tunnin päästä"],["%s tuntia sitten","%s tunnin päästä"],["päivä sitten","päivän päästä"],["%s päivää sitten","%s päivän päästä"],["viikko sitten","viikon päästä"],["%s viikkoa sitten","%s viikon päästä"],["kuukausi sitten","kuukauden päästä"],["%s kuukautta sitten","%s kuukauden päästä"],["vuosi sitten","vuoden päästä"],["%s vuotta sitten","%s vuoden päästä"]][n]},fr:function(s,n){return[["à l'instant","dans un instant"],["il y a %s secondes","dans %s secondes"],["il y a 1 minute","dans 1 minute"],["il y a %s minutes","dans %s minutes"],["il y a 1 heure","dans 1 heure"],["il y a %s heures","dans %s heures"],["il y a 1 jour","dans 1 jour"],["il y a %s jours","dans %s jours"],["il y a 1 semaine","dans 1 semaine"],["il y a %s semaines","dans %s semaines"],["il y a 1 mois","dans 1 mois"],["il y a %s mois","dans %s mois"],["il y a 1 an","dans 1 an"],["il y a %s ans","dans %s ans"]][n]},gl:function(s,n){return[["xusto agora","daquí a un pouco"],["hai %s segundos","en %s segundos"],["hai 1 minuto","nun minuto"],["hai %s minutos","en %s minutos"],["hai 1 hora","nunha hora"],["hai %s horas","en %s horas"],["hai 1 día","nun día"],["hai %s días","en %s días"],["hai 1 semana","nunha semana"],["hai %s semanas","en %s semanas"],["hai 1 mes","nun mes"],["hai %s meses","en %s meses"],["hai 1 ano","nun ano"],["hai %s anos","en %s anos"]][n]},he:function(s,n){return[["זה עתה","עכשיו"],["לפני %s שניות","בעוד %s שניות"],["לפני דקה","בעוד דקה"],["לפני %s דקות","בעוד %s דקות"],["לפני שעה","בעוד שעה"],["לפני %s שעות","בעוד %s שעות"],["אתמול","מחר"],["לפני %s ימים","בעוד %s ימים"],["לפני שבוע","בעוד שבוע"],["לפני %s שבועות","בעוד %s שבועות"],["לפני חודש","בעוד חודש"],["לפני %s חודשים","בעוד %s חודשים"],["לפני שנה","בעוד שנה"],["לפני %s שנים","בעוד %s שנים"]][n]},hu:function(s,n){return[["éppen most","éppen most"],["%s másodperce","%s másodpercen belül"],["1 perce","1 percen belül"],["%s perce","%s percen belül"],["1 órája","1 órán belül"],["%s órája","%s órán belül"],["1 napja","1 napon belül"],["%s napja","%s napon belül"],["1 hete","1 héten belül"],["%s hete","%s héten belül"],["1 hónapja","1 hónapon belül"],["%s hónapja","%s hónapon belül"],["1 éve","1 éven belül"],["%s éve","%s éven belül"]][n]},in_BG:function(s,n){return[["এইমাত্র","একটা সময়"],["%s সেকেন্ড আগে","%s এর সেকেন্ডের মধ্যে"],["1 মিনিট আগে","1 মিনিটে"],["%s এর মিনিট আগে","%s এর মিনিটের মধ্যে"],["1 ঘন্টা আগে","1 ঘন্টা"],["%s ঘণ্টা আগে","%s এর ঘন্টার মধ্যে"],["1 দিন আগে","1 দিনের মধ্যে"],["%s এর দিন আগে","%s এর দিন"],["1 সপ্তাহ আগে","1 সপ্তাহের মধ্যে"],["%s এর সপ্তাহ আগে","%s সপ্তাহের মধ্যে"],["1 মাস আগে","1 মাসে"],["%s মাস আগে","%s মাসে"],["1 বছর আগে","1 বছরের মধ্যে"],["%s বছর আগে","%s বছরে"]][n]},in_HI:function(s,n){return[["अभी","कुछ समय"],["%s सेकंड पहले","%s सेकंड में"],["1 मिनट पहले","1 मिनट में"],["%s मिनट पहले","%s मिनट में"],["1 घंटे पहले","1 घंटे में"],["%s घंटे पहले","%s घंटे में"],["1 दिन पहले","1 दिन में"],["%s दिन पहले","%s दिनों में"],["1 सप्ताह पहले","1 सप्ताह में"],["%s हफ्ते पहले","%s हफ्तों में"],["1 महीने पहले","1 महीने में"],["%s महीने पहले","%s महीनों में"],["1 साल पहले","1 साल में"],["%s साल पहले","%s साल में"]][n]},in_ID:function(s,n){return[["baru saja","sebentar"],["%s detik yang lalu","dalam %s detik"],["1 menit yang lalu","dalam 1 menit"],["%s menit yang lalu","dalam %s menit"],["1 jam yang lalu","dalam 1 jam"],["%s jam yang lalu","dalam %s jam"],["1 hari yang lalu","dalam 1 hari"],["%s hari yang lalu","dalam %s hari"],["1 minggu yang lalu","dalam 1 minggu"],["%s minggu yang lalu","dalam %s minggu"],["1 bulan yang lalu","dalam 1 bulan"],["%s bulan yang lalu","dalam %s bulan"],["1 tahun yang lalu","dalam 1 tahun"],["%s tahun yang lalu","dalam %s tahun"]][n]},it:function(s,n){return[["poco fa","tra poco"],["%s secondi fa","%s secondi da ora"],["un minuto fa","un minuto da ora"],["%s minuti fa","%s minuti da ora"],["un'ora fa","un'ora da ora"],["%s ore fa","%s ore da ora"],["un giorno fa","un giorno da ora"],["%s giorni fa","%s giorni da ora"],["una settimana fa","una settimana da ora"],["%s settimane fa","%s settimane da ora"],["un mese fa","un mese da ora"],["%s mesi fa","%s mesi da ora"],["un anno fa","un anno da ora"],["%s anni fa","%s anni da ora"]][n]},ja:function(s,n){return[["すこし前","すぐに"],["%s秒前","%s秒以内"],["1分前","1分以内"],["%s分前","%s分以内"],["1時間前","1時間以内"],["%s時間前","%s時間以内"],["1日前","1日以内"],["%s日前","%s日以内"],["1週間前","1週間以内"],["%s週間前","%s週間以内"],["1ヶ月前","1ヶ月以内"],["%sヶ月前","%sヶ月以内"],["1年前","1年以内"],["%s年前","%s年以内"]][n]},ko:function(s,n){return[["방금","곧"],["%s초 전","%s초 후"],["1분 전","1분 후"],["%s분 전","%s분 후"],["1시간 전","1시간 후"],["%s시간 전","%s시간 후"],["1일 전","1일 후"],["%s일 전","%s일 후"],["1주일 전","1주일 후"],["%s주일 전","%s주일 후"],["1개월 전","1개월 후"],["%s개월 전","%s개월 후"],["1년 전","1년 후"],["%s년 전","%s년 후"]][n]},ml:function(s,n){return[["ഇപ്പോള്‍","കുറച്ചു മുന്‍പ്"],["%s സെക്കന്റ്‌കള്‍ക്ക് മുന്‍പ്","%s സെക്കന്റില്‍"],["1 മിനിറ്റിനു മുന്‍പ്","1 മിനിറ്റില്‍"],["%s മിനിറ്റുകള്‍ക്ക് മുന്‍പ","%s മിനിറ്റില്‍"],["1 മണിക്കൂറിനു മുന്‍പ്","1 മണിക്കൂറില്‍"],["%s മണിക്കൂറുകള്‍ക്കു മുന്‍പ്","%s മണിക്കൂറില്‍"],["1 ഒരു ദിവസം മുന്‍പ്","1 ദിവസത്തില്‍"],["%s ദിവസങ്ങള്‍ക് മുന്‍പ്","%s ദിവസങ്ങള്‍ക്കുള്ളില്‍"],["1 ആഴ്ച മുന്‍പ്","1 ആഴ്ചയില്‍"],["%s ആഴ്ചകള്‍ക്ക് മുന്‍പ്","%s ആഴ്ചകള്‍ക്കുള്ളില്‍"],["1 മാസത്തിനു മുന്‍പ്","1 മാസത്തിനുള്ളില്‍"],["%s മാസങ്ങള്‍ക്ക് മുന്‍പ്","%s മാസങ്ങള്‍ക്കുള്ളില്‍"],["1 വര്‍ഷത്തിനു മുന്‍പ്","1 വര്‍ഷത്തിനുള്ളില്‍"],["%s വര്‍ഷങ്ങള്‍ക്കു മുന്‍പ്","%s വര്‍ഷങ്ങള്‍ക്കുല്ല്ളില്‍"]][n]},my:function(s,n){return[["ယခုအတွင်း","ယခု"],["%s စက္ကန့် အကြာက","%s စက္ကန့်အတွင်း"],["1 မိနစ် အကြာက","1 မိနစ်အတွင်း"],["%s မိနစ် အကြာက","%s မိနစ်အတွင်း"],["1 နာရီ အကြာက","1 နာရီအတွင်း"],["%s နာရီ အကြာက","%s နာရီအတွင်း"],["1 ရက် အကြာက","1 ရက်အတွင်း"],["%s ရက် အကြာက","%s ရက်အတွင်း"],["1 ပတ် အကြာက","1 ပတ်အတွင်း"],["%s ပတ် အကြာက","%s ပတ်အတွင်း"],["1 လ အကြာက","1 လအတွင်း"],["%s လ အကြာက","%s လအတွင်း"],["1 နှစ် အကြာက","1 နှစ်အတွင်း"],["%s နှစ် အကြာက","%s နှစ်အတွင်း"]][n]},nb_NO:function(s,n){return[["akkurat nå","om litt"],["%s sekunder siden","om %s sekunder"],["1 minutt siden","om 1 minutt"],["%s minutter siden","om %s minutter"],["1 time siden","om 1 time"],["%s timer siden","om %s timer"],["1 dag siden","om 1 dag"],["%s dager siden","om %s dager"],["1 uke siden","om 1 uke"],["%s uker siden","om %s uker"],["1 måned siden","om 1 måned"],["%s måneder siden","om %s måneder"],["1 år siden","om 1 år"],["%s år siden","om %s år"]][n]},nl:function(s,n){return[["recent","binnenkort"],["%s seconden geleden","binnen %s seconden"],["1 minuut geleden","binnen 1 minuut"],["%s minuten geleden","binnen %s minuten"],["1 uur geleden","binnen 1 uur"],["%s uren geleden","binnen %s uren"],["1 dag geleden","binnen 1 dag"],["%s dagen geleden","binnen %s dagen"],["1 week geleden","binnen 1 week"],["%s weken geleden","binnen %s weken"],["1 maand geleden","binnen 1 maand"],["%s maanden geleden","binnen %s maanden"],["1 jaar geleden","binnen 1 jaar"],["%s jaren geleden","binnen %s jaren"]][n]},nn_NO:function(s,n){return[["nett no","om litt"],["%s sekund sidan","om %s sekund"],["1 minutt sidan","om 1 minutt"],["%s minutt sidan","om %s minutt"],["1 time sidan","om 1 time"],["%s timar sidan","om %s timar"],["1 dag sidan","om 1 dag"],["%s dagar sidan","om %s dagar"],["1 veke sidan","om 1 veke"],["%s veker sidan","om %s veker"],["1 månad sidan","om 1 månad"],["%s månadar sidan","om %s månadar"],["1 år sidan","om 1 år"],["%s år sidan","om %s år"]][n]},pl:function(s,n){return m[1&n?s%10>4||s%10<2||1==~~(s/10)%10?n:++n/2+13:n]},pt_BR:function(s,n){return[["agora mesmo","daqui um pouco"],["há %s segundos","em %s segundos"],["há um minuto","em um minuto"],["há %s minutos","em %s minutos"],["há uma hora","em uma hora"],["há %s horas","em %s horas"],["há um dia","em um dia"],["há %s dias","em %s dias"],["há uma semana","em uma semana"],["há %s semanas","em %s semanas"],["há um mês","em um mês"],["há %s meses","em %s meses"],["há um ano","em um ano"],["há %s anos","em %s anos"]][n]},ro:function(s,n){var e=[["chiar acum","chiar acum"],["acum %s secunde","peste %s secunde"],["acum un minut","peste un minut"],["acum %s minute","peste %s minute"],["acum o oră","peste o oră"],["acum %s ore","peste %s ore"],["acum o zi","peste o zi"],["acum %s zile","peste %s zile"],["acum o săptămână","peste o săptămână"],["acum %s săptămâni","peste %s săptămâni"],["acum o lună","peste o lună"],["acum %s luni","peste %s luni"],["acum un an","peste un an"],["acum %s ani","peste %s ani"]];return s<20?e[n]:[e[n][0].replace("%s","%s de"),e[n][1].replace("%s","%s de")]},ru:function(s,n){switch(n){case 0:return["только что","через несколько секунд"];case 1:return[d(s)+" назад","через "+d(s)];case 2:case 3:return[l(s)+" назад","через "+l(s)];case 4:case 5:return[c(s)+" назад","через "+c(s)];case 6:return["вчера","завтра"];case 7:return[g(s)+" назад","через "+g(s)];case 8:case 9:return[h(s)+" назад","через "+h(s)];case 10:case 11:return[p(s)+" назад","через "+p(s)];case 12:case 13:return[f(s)+" назад","через "+f(s)];default:return["",""]}},sq:function(s,n){return[["pak më parë","pas pak"],["para %s sekondash","pas %s sekondash"],["para një minute","pas një minute"],["para %s minutash","pas %s minutash"],["para një ore","pas një ore"],["para %s orësh","pas %s orësh"],["dje","nesër"],["para %s ditësh","pas %s ditësh"],["para një jave","pas një jave"],["para %s javësh","pas %s javësh"],["para një muaji","pas një muaji"],["para %s muajsh","pas %s muajsh"],["para një viti","pas një viti"],["para %s vjetësh","pas %s vjetësh"]][n]},sr:function(s,n){switch(n){case 0:return["малопре","управо сад"];case 1:return["пре "+y(s),"за "+y(s)];case 2:case 3:return["пре "+k(s),"за "+k(s)];case 4:case 5:return["пре "+v(s),"за "+v(s)];case 6:case 7:return["пре "+j(s),"за "+j(s)];case 8:case 9:return["пре "+z(s),"за "+z(s)];case 10:case 11:return["пре "+w(s),"за "+w(s)];case 12:case 13:return["пре "+q(s),"за "+q(s)];default:return["",""]}},sv:function(s,n){return[["just nu","om en stund"],["%s sekunder sedan","om %s sekunder"],["1 minut sedan","om 1 minut"],["%s minuter sedan","om %s minuter"],["1 timme sedan","om 1 timme"],["%s timmar sedan","om %s timmar"],["1 dag sedan","om 1 dag"],["%s dagar sedan","om %s dagar"],["1 vecka sedan","om 1 vecka"],["%s veckor sedan","om %s veckor"],["1 månad sedan","om 1 månad"],["%s månader sedan","om %s månader"],["1 år sedan","om 1 år"],["%s år sedan","om %s år"]][n]},ta:function(s,n){return[["இப்போது","சற்று நேரம் முன்பு"],["%s நொடிக்கு முன்","%s நொடிகளில்"],["1 நிமிடத்திற்க்கு முன்","1 நிமிடத்தில்"],["%s நிமிடத்திற்க்கு முன்","%s நிமிடங்களில்"],["1 மணி நேரத்திற்கு முன்","1 மணி நேரத்திற்குள்"],["%s மணி நேரத்திற்கு முன்","%s மணி நேரத்திற்குள்"],["1 நாளுக்கு முன்","1 நாளில்"],["%s நாட்களுக்கு முன்","%s நாட்களில்"],["1 வாரத்திற்கு முன்","1 வாரத்தில்"],["%s வாரங்களுக்கு முன்","%s வாரங்களில்"],["1 மாதத்திற்கு முன்","1 மாதத்தில்"],["%s மாதங்களுக்கு முன்","%s மாதங்களில்"],["1 வருடத்திற்கு முன்","1 வருடத்தில்"],["%s வருடங்களுக்கு முன்","%s வருடங்களில்"]][n]},th:function(s,n){return[["เมื่อสักครู่นี้","อีกสักครู่"],["%s วินาทีที่แล้ว","ใน %s วินาที"],["1 นาทีที่แล้ว","ใน 1 นาที"],["%s นาทีที่แล้ว","ใน %s นาที"],["1 ชั่วโมงที่แล้ว","ใน 1 ชั่วโมง"],["%s ชั่วโมงที่แล้ว","ใน %s ชั่วโมง"],["1 วันที่แล้ว","ใน 1 วัน"],["%s วันที่แล้ว","ใน %s วัน"],["1 อาทิตย์ที่แล้ว","ใน 1 อาทิตย์"],["%s อาทิตย์ที่แล้ว","ใน %s อาทิตย์"],["1 เดือนที่แล้ว","ใน 1 เดือน"],["%s เดือนที่แล้ว","ใน %s เดือน"],["1 ปีที่แล้ว","ใน 1 ปี"],["%s ปีที่แล้ว","ใน %s ปี"]][n]},tr:function(s,n){return[["az önce","şimdi"],["%s saniye önce","%s saniye içinde"],["1 dakika önce","1 dakika içinde"],["%s dakika önce","%s dakika içinde"],["1 saat önce","1 saat içinde"],["%s saat önce","%s saat içinde"],["1 gün önce","1 gün içinde"],["%s gün önce","%s gün içinde"],["1 hafta önce","1 hafta içinde"],["%s hafta önce","%s hafta içinde"],["1 ay önce","1 ay içinde"],["%s ay önce","%s ay içinde"],["1 yıl önce","1 yıl içinde"],["%s yıl önce","%s yıl içinde"]][n]},uk:function(s,n){switch(n){case 0:return["щойно","через декілька секунд"];case 1:return[_(s)+" тому","через "+_(s)];case 2:case 3:return[S(s)+" тому","через "+S(s)];case 4:case 5:return[W(s)+" тому","через "+W(s)];case 6:case 7:return[T(s)+" тому","через "+T(s)];case 8:case 9:return[J(s)+" тому","через "+J(s)];case 10:case 11:return[x(s)+" тому","через "+x(s)];case 12:case 13:return[N(s)+" тому","через "+N(s)];default:return["",""]}},vi:function(s,n){return[["vừa xong","một lúc"],["%s giây trước","trong %s giây"],["1 phút trước","trong 1 phút"],["%s phút trước","trong %s phút"],["1 giờ trước","trong 1 giờ"],["%s giờ trước","trong %s giờ"],["1 ngày trước","trong 1 ngày"],["%s ngày trước","trong %s ngày"],["1 tuần trước","trong 1 tuần"],["%s tuần trước","trong %s tuần"],["1 tháng trước","trong 1 tháng"],["%s tháng trước","trong %s tháng"],["1 năm trước","trong 1 năm"],["%s năm trước","trong %s năm"]][n]},zh_CN:function(s,n){return[["刚刚","片刻后"],["%s秒前","%s秒后"],["1分钟前","1分钟后"],["%s分钟前","%s分钟后"],["1小时前","1小时后"],["%s小时前","%s小时后"],["1天前","1天后"],["%s天前","%s天后"],["1周前","1周后"],["%s周前","%s周后"],["1月前","1月后"],["%s月前","%s月后"],["1年前","1年后"],["%s年前","%s年后"]][n]},zh_TW:function(s,n){return[["剛剛","片刻後"],["%s秒前","%s秒後"],["1分鐘前","1分鐘後"],["%s分鐘前","%s分鐘後"],["1小時前","1小時後"],["%s小時前","%s小時後"],["1天前","1天後"],["%s天前","%s天後"],["1周前","1周後"],["%s周前","%s周後"],["1月前","1月後"],["%s月前","%s月後"],["1年前","1年後"],["%s年前","%s年後"]][n]}},I=!0,C=!1,D=void 0;try{for(var G,H=Object.keys(B)[Symbol.iterator]();!(I=(G=H.next()).done);I=!0){var R=G.value;timeago.register(R,B[R])}}catch(s){C=!0,D=s}finally{try{!I&&H.return&&H.return()}finally{if(C)throw D}}}(); diff --git a/lib/lang/ar.js b/lib/lang/ar.js new file mode 100644 index 0000000..4277579 --- /dev/null +++ b/lib/lang/ar.js @@ -0,0 +1,28 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + if (index === 0) { + return ['منذ لحظات', 'بعد لحظات']; + } + + var timeStr = formatTime(Math.floor(index / 2), number); + return ['منذ' + ' ' + timeStr, 'بعد' + ' ' + timeStr]; +}; + +var timeTypes = [['ثانية', 'ثانيتين', '%s ثوان', '%s ثانية'], // Seconds +['دقيقة', 'دقيقتين', '%s دقائق', '%s دقيقة'], // Minutes +['ساعة', 'ساعتين', '%s ساعات', '%s ساعة'], // Hours +['يوم', 'يومين', '%s أيام', '%s يوماً'], // Days +['أسبوع', 'أسبوعين', '%s أسابيع', '%s أسبوعاً'], // Weeks +['شهر', 'شهرين', '%s أشهر', '%s شهراً'], // Months +['عام', 'عامين', '%s أعوام', '%s عاماً'] // Years +]; + +function formatTime(type, n) { + if (n < 3) return timeTypes[type][n - 1];else if (n >= 3 && n <= 10) return timeTypes[type][2];else return timeTypes[type][3]; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/be.js b/lib/lang/be.js new file mode 100644 index 0000000..67f5fb1 --- /dev/null +++ b/lib/lang/be.js @@ -0,0 +1,69 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + switch (index) { + case 0: + return ['толькі што', 'праз некалькі секунд']; + case 1: + return [seconds(number) + ' таму', 'праз ' + seconds(number)]; + case 2: + case 3: + return [minutes(number) + ' таму', 'праз ' + minutes(number)]; + case 4: + case 5: + return [hours(number) + ' таму', 'праз ' + hours(number)]; + case 6: + case 7: + return [days(number) + ' таму', 'праз ' + days(number)]; + case 8: + case 9: + return [weeks(number) + ' таму', 'праз ' + weeks(number)]; + case 10: + case 11: + return [months(number) + ' таму', 'праз ' + months(number)]; + case 12: + case 13: + return [years(number) + ' таму', 'праз ' + years(number)]; + default: + return ['', '']; + } +}; + +var seconds = formatNum.bind(null, 'секунду', '%s секунду', '%s секунды', '%s секунд'), + minutes = formatNum.bind(null, 'хвіліну', '%s хвіліну', '%s хвіліны', '%s хвілін'), + hours = formatNum.bind(null, 'гадзіну', '%s гадзіну', '%s гадзіны', '%s гадзін'), + days = formatNum.bind(null, 'дзень', '%s дзень', '%s дні', '%s дзён'), + weeks = formatNum.bind(null, 'тыдзень', '%s тыдзень', '%s тыдні', '%s тыдняў'), + months = formatNum.bind(null, 'месяц', '%s месяц', '%s месяцы', '%s месяцаў'), + years = formatNum.bind(null, 'год', '%s год', '%s гады', '%s гадоў'); + +; + +/** + * + * @param f1 - 1 + * @param f - 21, 31, ... + * @param s - 2-4, 22-24, 32-34 ... + * @param t - 5-20, 25-30, ... + * @param n + * @returns {string} + */ +function formatNum(f1, f, s, t, n) { + var n10 = n % 10, + str = t; + + if (n === 1) { + str = f1; + } else if (n10 === 1 && n > 20) { + str = f; + } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) { + str = s; + } + + return str; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/bg.js b/lib/lang/bg.js new file mode 100644 index 0000000..ae10335 --- /dev/null +++ b/lib/lang/bg.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['току що', 'съвсем скоро'], ['преди %s секунди', 'след %s секунди'], ['преди 1 минута', 'след 1 минута'], ['преди %s минути', 'след %s минути'], ['преди 1 час', 'след 1 час'], ['преди %s часа', 'след %s часа'], ['преди 1 ден', 'след 1 ден'], ['преди %s дни', 'след %s дни'], ['преди 1 седмица', 'след 1 седмица'], ['преди %s седмици', 'след %s седмици'], ['преди 1 месец', 'след 1 месец'], ['преди %s месеца', 'след %s месеца'], ['преди 1 година', 'след 1 година'], ['преди %s години', 'след %s години']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/ca.js b/lib/lang/ca.js new file mode 100644 index 0000000..e360d1d --- /dev/null +++ b/lib/lang/ca.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['fa un moment', 'd\'aquí un moment'], ['fa %s segons', 'd\'aquí %s segons'], ['fa 1 minut', 'd\'aquí 1 minut'], ['fa %s minuts', 'd\'aquí %s minuts'], ['fa 1 hora', 'd\'aquí 1 hora'], ['fa %s hores', 'd\'aquí %s hores'], ['fa 1 dia', 'd\'aquí 1 dia'], ['fa %s dies', 'd\'aquí %s dies'], ['fa 1 setmana', 'd\'aquí 1 setmana'], ['fa %s setmanes', 'd\'aquí %s setmanes'], ['fa 1 mes', 'd\'aquí 1 mes'], ['fa %s mesos', 'd\'aquí %s mesos'], ['fa 1 any', 'd\'aquí 1 any'], ['fa %s anys', 'd\'aquí %s anys']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/da.js b/lib/lang/da.js new file mode 100644 index 0000000..9b635d2 --- /dev/null +++ b/lib/lang/da.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['for et øjeblik siden', 'om et øjeblik'], ['for %s sekunder siden', 'om %s sekunder'], ['for 1 minut siden', 'om 1 minut'], ['for %s minutter siden', 'om %s minutter'], ['for 1 time siden', 'om 1 time'], ['for %s timer siden', 'om %s timer'], ['for 1 dag siden', 'om 1 dag'], ['for %s dage siden', 'om %s dage'], ['for 1 uge siden', 'om 1 uge'], ['for %s uger siden', 'om %s uger'], ['for 1 måned siden', 'om 1 måned'], ['for %s måneder siden', 'om %s måneder'], ['for 1 år siden', 'om 1 år'], ['for %s år siden', 'om %s år']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/de.js b/lib/lang/de.js new file mode 100644 index 0000000..35f9670 --- /dev/null +++ b/lib/lang/de.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['gerade eben', 'vor einer Weile'], ['vor %s Sekunden', 'in %s Sekunden'], ['vor 1 Minute', 'in 1 Minute'], ['vor %s Minuten', 'in %s Minuten'], ['vor 1 Stunde', 'in 1 Stunde'], ['vor %s Stunden', 'in %s Stunden'], ['vor 1 Tag', 'in 1 Tag'], ['vor %s Tagen', 'in %s Tagen'], ['vor 1 Woche', 'in 1 Woche'], ['vor %s Wochen', 'in %s Wochen'], ['vor 1 Monat', 'in 1 Monat'], ['vor %s Monaten', 'in %s Monaten'], ['vor 1 Jahr', 'in 1 Jahr'], ['vor %s Jahren', 'in %s Jahren']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/el.js b/lib/lang/el.js new file mode 100644 index 0000000..45e88bf --- /dev/null +++ b/lib/lang/el.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['μόλις τώρα', 'σε λίγο'], ['%s δευτερόλεπτα πριν', 'σε %s δευτερόλεπτα'], ['1 λεπτό πριν', 'σε 1 λεπτό'], ['%s λεπτά πριν', 'σε %s λεπτά'], ['1 ώρα πριν', 'σε 1 ώρα'], ['%s ώρες πριν', 'σε %s ώρες'], ['1 μέρα πριν', 'σε 1 μέρα'], ['%s μέρες πριν', 'σε %s μέρες'], ['1 εβδομάδα πριν', 'σε 1 εβδομάδα'], ['%s εβδομάδες πριν', 'σε %s εβδομάδες'], ['1 μήνα πριν', 'σε 1 μήνα'], ['%s μήνες πριν', 'σε %s μήνες'], ['1 χρόνο πριν', 'σε 1 χρόνο'], ['%s χρόνια πριν', 'σε %s χρόνια']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/en.js b/lib/lang/en.js new file mode 100644 index 0000000..e8e2585 --- /dev/null +++ b/lib/lang/en.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['just now', 'right now'], ['%s seconds ago', 'in %s seconds'], ['1 minute ago', 'in 1 minute'], ['%s minutes ago', 'in %s minutes'], ['1 hour ago', 'in 1 hour'], ['%s hours ago', 'in %s hours'], ['1 day ago', 'in 1 day'], ['%s days ago', 'in %s days'], ['1 week ago', 'in 1 week'], ['%s weeks ago', 'in %s weeks'], ['1 month ago', 'in 1 month'], ['%s months ago', 'in %s months'], ['1 year ago', 'in 1 year'], ['%s years ago', 'in %s years']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/en_short.js b/lib/lang/en_short.js new file mode 100644 index 0000000..bb5fe34 --- /dev/null +++ b/lib/lang/en_short.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['just now', 'right now'], ['%ss ago', 'in %ss'], ['1m ago', 'in 1m'], ['%sm ago', 'in %sm'], ['1h ago', 'in 1h'], ['%sh ago', 'in %sh'], ['1d ago', 'in 1d'], ['%sd ago', 'in %sd'], ['1w ago', 'in 1w'], ['%sw ago', 'in %sw'], ['1mo ago', 'in 1mo'], ['%smo ago', 'in %smo'], ['1yr ago', 'in 1yr'], ['%syr ago', 'in %syr']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/es.js b/lib/lang/es.js new file mode 100644 index 0000000..2f445a9 --- /dev/null +++ b/lib/lang/es.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['justo ahora', 'en un rato'], ['hace %s segundos', 'en %s segundos'], ['hace 1 minuto', 'en 1 minuto'], ['hace %s minutos', 'en %s minutos'], ['hace 1 hora', 'en 1 hora'], ['hace %s horas', 'en %s horas'], ['hace 1 día', 'en 1 día'], ['hace %s días', 'en %s días'], ['hace 1 semana', 'en 1 semana'], ['hace %s semanas', 'en %s semanas'], ['hace 1 mes', 'en 1 mes'], ['hace %s meses', 'en %s meses'], ['hace 1 año', 'en 1 año'], ['hace %s años', 'en %s años']][index]; +}; + +; +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/eu.js b/lib/lang/eu.js new file mode 100644 index 0000000..578cbad --- /dev/null +++ b/lib/lang/eu.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['orain', 'denbora bat barru'], ['duela %s segundu', '%s segundu barru'], ['duela minutu 1', 'minutu 1 barru'], ['duela %s minutu', '%s minutu barru'], ['duela ordu 1', 'ordu 1 barru'], ['duela %s ordu', '%s ordu barru'], ['duela egun 1', 'egun 1 barru'], ['duela %s egun', '%s egun barru'], ['duela aste 1', 'aste 1 barru'], ['duela %s aste', '%s aste barru'], ['duela hillabete 1', 'hillabete 1 barru'], ['duela %s hillabete', '%s hillabete barru'], ['duela urte 1', 'urte 1 barru'], ['duela %s urte', '%s urte barru']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/fa.js b/lib/lang/fa.js new file mode 100644 index 0000000..14c9e43 --- /dev/null +++ b/lib/lang/fa.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['همین الآن', 'لحظاتی پیش'], ['%s ثانیه پیش', 'حدود %s ثانیه پیش'], ['1 دقیقه پیش', 'حدود 1 دقیقه پیش'], ['%s دقیقه پیش', 'حدود %s دقیقه پیش'], ['1 ساعت پیش', 'حدود 1 ساعت پیش'], ['%s ساعت پیش', 'حدود %s ساعت پیش'], ['1 روز پیش', 'حدود 1 روز پیش'], ['%s روز پیش', 'حدود %s روز پیش'], ['1 هفته پیش', 'حدود 1 هفته پیش'], ['%s هفته پیش', 'حدود %s هفته پیش'], ['1 ماه پیش', 'حدود 1 ماه پیش'], ['%s ماه پیش', 'حدود %s ماه پیش'], ['1 سال پیش', 'حدود 1 سال پیش'], ['%s سال پیش', 'حدود %s سال پیش']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/fi.js b/lib/lang/fi.js new file mode 100644 index 0000000..2820339 --- /dev/null +++ b/lib/lang/fi.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['juuri äsken', 'juuri nyt'], ['%s sekuntia sitten', '%s sekunnin päästä'], ['minuutti sitten', 'minuutin päästä'], ['%s minuuttia sitten', '%s minuutin päästä'], ['tunti sitten', 'tunnin päästä'], ['%s tuntia sitten', '%s tunnin päästä'], ['päivä sitten', 'päivän päästä'], ['%s päivää sitten', '%s päivän päästä'], ['viikko sitten', 'viikon päästä'], ['%s viikkoa sitten', '%s viikon päästä'], ['kuukausi sitten', 'kuukauden päästä'], ['%s kuukautta sitten', '%s kuukauden päästä'], ['vuosi sitten', 'vuoden päästä'], ['%s vuotta sitten', '%s vuoden päästä']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/fr.js b/lib/lang/fr.js new file mode 100644 index 0000000..cc0cc5f --- /dev/null +++ b/lib/lang/fr.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['à l\'instant', 'dans un instant'], ['il y a %s secondes', 'dans %s secondes'], ['il y a 1 minute', 'dans 1 minute'], ['il y a %s minutes', 'dans %s minutes'], ['il y a 1 heure', 'dans 1 heure'], ['il y a %s heures', 'dans %s heures'], ['il y a 1 jour', 'dans 1 jour'], ['il y a %s jours', 'dans %s jours'], ['il y a 1 semaine', 'dans 1 semaine'], ['il y a %s semaines', 'dans %s semaines'], ['il y a 1 mois', 'dans 1 mois'], ['il y a %s mois', 'dans %s mois'], ['il y a 1 an', 'dans 1 an'], ['il y a %s ans', 'dans %s ans']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/gl.js b/lib/lang/gl.js new file mode 100644 index 0000000..279d04c --- /dev/null +++ b/lib/lang/gl.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['xusto agora', 'daquí a un pouco'], ['hai %s segundos', 'en %s segundos'], ['hai 1 minuto', 'nun minuto'], ['hai %s minutos', 'en %s minutos'], ['hai 1 hora', 'nunha hora'], ['hai %s horas', 'en %s horas'], ['hai 1 día', 'nun día'], ['hai %s días', 'en %s días'], ['hai 1 semana', 'nunha semana'], ['hai %s semanas', 'en %s semanas'], ['hai 1 mes', 'nun mes'], ['hai %s meses', 'en %s meses'], ['hai 1 ano', 'nun ano'], ['hai %s anos', 'en %s anos']][index]; +}; + +; +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/he.js b/lib/lang/he.js new file mode 100644 index 0000000..4fa8a6c --- /dev/null +++ b/lib/lang/he.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['זה עתה', 'עכשיו'], ['לפני %s שניות', 'בעוד %s שניות'], ['לפני דקה', 'בעוד דקה'], ['לפני %s דקות', 'בעוד %s דקות'], ['לפני שעה', 'בעוד שעה'], ['לפני %s שעות', 'בעוד %s שעות'], ['אתמול', 'מחר'], ['לפני %s ימים', 'בעוד %s ימים'], ['לפני שבוע', 'בעוד שבוע'], ['לפני %s שבועות', 'בעוד %s שבועות'], ['לפני חודש', 'בעוד חודש'], ['לפני %s חודשים', 'בעוד %s חודשים'], ['לפני שנה', 'בעוד שנה'], ['לפני %s שנים', 'בעוד %s שנים']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/hu.js b/lib/lang/hu.js new file mode 100644 index 0000000..5e99a70 --- /dev/null +++ b/lib/lang/hu.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['éppen most', 'éppen most'], ['%s másodperce', '%s másodpercen belül'], ['1 perce', '1 percen belül'], ['%s perce', '%s percen belül'], ['1 órája', '1 órán belül'], ['%s órája', '%s órán belül'], ['1 napja', '1 napon belül'], ['%s napja', '%s napon belül'], ['1 hete', '1 héten belül'], ['%s hete', '%s héten belül'], ['1 hónapja', '1 hónapon belül'], ['%s hónapja', '%s hónapon belül'], ['1 éve', '1 éven belül'], ['%s éve', '%s éven belül']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/in_BG.js b/lib/lang/in_BG.js new file mode 100644 index 0000000..39361d4 --- /dev/null +++ b/lib/lang/in_BG.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['এইমাত্র', 'একটা সময়'], ['%s সেকেন্ড আগে', '%s এর সেকেন্ডের মধ্যে'], ['1 মিনিট আগে', '1 মিনিটে'], ['%s এর মিনিট আগে', '%s এর মিনিটের মধ্যে'], ['1 ঘন্টা আগে', '1 ঘন্টা'], ['%s ঘণ্টা আগে', '%s এর ঘন্টার মধ্যে'], ['1 দিন আগে', '1 দিনের মধ্যে'], ['%s এর দিন আগে', '%s এর দিন'], ['1 সপ্তাহ আগে', '1 সপ্তাহের মধ্যে'], ['%s এর সপ্তাহ আগে', '%s সপ্তাহের মধ্যে'], ['1 মাস আগে', '1 মাসে'], ['%s মাস আগে', '%s মাসে'], ['1 বছর আগে', '1 বছরের মধ্যে'], ['%s বছর আগে', '%s বছরে']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/in_HI.js b/lib/lang/in_HI.js new file mode 100644 index 0000000..f3974aa --- /dev/null +++ b/lib/lang/in_HI.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['अभी', 'कुछ समय'], ['%s सेकंड पहले', '%s सेकंड में'], ['1 मिनट पहले', '1 मिनट में'], ['%s मिनट पहले', '%s मिनट में'], ['1 घंटे पहले', '1 घंटे में'], ['%s घंटे पहले', '%s घंटे में'], ['1 दिन पहले', '1 दिन में'], ['%s दिन पहले', '%s दिनों में'], ['1 सप्ताह पहले', '1 सप्ताह में'], ['%s हफ्ते पहले', '%s हफ्तों में'], ['1 महीने पहले', '1 महीने में'], ['%s महीने पहले', '%s महीनों में'], ['1 साल पहले', '1 साल में'], ['%s साल पहले', '%s साल में']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/in_ID.js b/lib/lang/in_ID.js new file mode 100644 index 0000000..cfecc38 --- /dev/null +++ b/lib/lang/in_ID.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['baru saja', 'sebentar'], ['%s detik yang lalu', 'dalam %s detik'], ['1 menit yang lalu', 'dalam 1 menit'], ['%s menit yang lalu', 'dalam %s menit'], ['1 jam yang lalu', 'dalam 1 jam'], ['%s jam yang lalu', 'dalam %s jam'], ['1 hari yang lalu', 'dalam 1 hari'], ['%s hari yang lalu', 'dalam %s hari'], ['1 minggu yang lalu', 'dalam 1 minggu'], ['%s minggu yang lalu', 'dalam %s minggu'], ['1 bulan yang lalu', 'dalam 1 bulan'], ['%s bulan yang lalu', 'dalam %s bulan'], ['1 tahun yang lalu', 'dalam 1 tahun'], ['%s tahun yang lalu', 'dalam %s tahun']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/index.js b/lib/lang/index.js new file mode 100644 index 0000000..2c88939 --- /dev/null +++ b/lib/lang/index.js @@ -0,0 +1,216 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _ar = require('./ar'); + +var _ar2 = _interopRequireDefault(_ar); + +var _be = require('./be'); + +var _be2 = _interopRequireDefault(_be); + +var _bg = require('./bg'); + +var _bg2 = _interopRequireDefault(_bg); + +var _ca = require('./ca'); + +var _ca2 = _interopRequireDefault(_ca); + +var _de = require('./de'); + +var _de2 = _interopRequireDefault(_de); + +var _el = require('./el'); + +var _el2 = _interopRequireDefault(_el); + +var _en = require('./en'); + +var _en2 = _interopRequireDefault(_en); + +var _en_short = require('./en_short'); + +var _en_short2 = _interopRequireDefault(_en_short); + +var _es = require('./es'); + +var _es2 = _interopRequireDefault(_es); + +var _eu = require('./eu'); + +var _eu2 = _interopRequireDefault(_eu); + +var _fa = require('./fa'); + +var _fa2 = _interopRequireDefault(_fa); + +var _fi = require('./fi'); + +var _fi2 = _interopRequireDefault(_fi); + +var _fr = require('./fr'); + +var _fr2 = _interopRequireDefault(_fr); + +var _gl = require('./gl'); + +var _gl2 = _interopRequireDefault(_gl); + +var _he = require('./he'); + +var _he2 = _interopRequireDefault(_he); + +var _hu = require('./hu'); + +var _hu2 = _interopRequireDefault(_hu); + +var _in_BG = require('./in_BG'); + +var _in_BG2 = _interopRequireDefault(_in_BG); + +var _in_HI = require('./in_HI'); + +var _in_HI2 = _interopRequireDefault(_in_HI); + +var _in_ID = require('./in_ID'); + +var _in_ID2 = _interopRequireDefault(_in_ID); + +var _it = require('./it'); + +var _it2 = _interopRequireDefault(_it); + +var _ja = require('./ja'); + +var _ja2 = _interopRequireDefault(_ja); + +var _ko = require('./ko'); + +var _ko2 = _interopRequireDefault(_ko); + +var _ml = require('./ml'); + +var _ml2 = _interopRequireDefault(_ml); + +var _my = require('./my'); + +var _my2 = _interopRequireDefault(_my); + +var _nb_NO = require('./nb_NO'); + +var _nb_NO2 = _interopRequireDefault(_nb_NO); + +var _nl = require('./nl'); + +var _nl2 = _interopRequireDefault(_nl); + +var _nn_NO = require('./nn_NO'); + +var _nn_NO2 = _interopRequireDefault(_nn_NO); + +var _pl = require('./pl'); + +var _pl2 = _interopRequireDefault(_pl); + +var _pt_BR = require('./pt_BR'); + +var _pt_BR2 = _interopRequireDefault(_pt_BR); + +var _ro = require('./ro'); + +var _ro2 = _interopRequireDefault(_ro); + +var _ru = require('./ru'); + +var _ru2 = _interopRequireDefault(_ru); + +var _sq = require('./sq'); + +var _sq2 = _interopRequireDefault(_sq); + +var _sr = require('./sr'); + +var _sr2 = _interopRequireDefault(_sr); + +var _sv = require('./sv'); + +var _sv2 = _interopRequireDefault(_sv); + +var _ta = require('./ta'); + +var _ta2 = _interopRequireDefault(_ta); + +var _th = require('./th'); + +var _th2 = _interopRequireDefault(_th); + +var _tr = require('./tr'); + +var _tr2 = _interopRequireDefault(_tr); + +var _uk = require('./uk'); + +var _uk2 = _interopRequireDefault(_uk); + +var _vi = require('./vi'); + +var _vi2 = _interopRequireDefault(_vi); + +var _zh_CN = require('./zh_CN'); + +var _zh_CN2 = _interopRequireDefault(_zh_CN); + +var _zh_TW = require('./zh_TW'); + +var _zh_TW2 = _interopRequireDefault(_zh_TW); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = { + ar: _ar2.default, + be: _be2.default, + bg: _bg2.default, + ca: _ca2.default, + de: _de2.default, + el: _el2.default, + en: _en2.default, + en_short: _en_short2.default, + es: _es2.default, + eu: _eu2.default, + fa: _fa2.default, + fi: _fi2.default, + fr: _fr2.default, + gl: _gl2.default, + he: _he2.default, + hu: _hu2.default, + in_BG: _in_BG2.default, + in_HI: _in_HI2.default, + in_ID: _in_ID2.default, + it: _it2.default, + ja: _ja2.default, + ko: _ko2.default, + ml: _ml2.default, + my: _my2.default, + nb_NO: _nb_NO2.default, + nl: _nl2.default, + nn_NO: _nn_NO2.default, + pl: _pl2.default, + pt_BR: _pt_BR2.default, + ro: _ro2.default, + ru: _ru2.default, + sq: _sq2.default, + sr: _sr2.default, + sv: _sv2.default, + ta: _ta2.default, + th: _th2.default, + tr: _tr2.default, + uk: _uk2.default, + vi: _vi2.default, + zh_CN: _zh_CN2.default, + zh_TW: _zh_TW2.default +}; +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/it.js b/lib/lang/it.js new file mode 100644 index 0000000..39be684 --- /dev/null +++ b/lib/lang/it.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['poco fa', 'tra poco'], ['%s secondi fa', '%s secondi da ora'], ['un minuto fa', 'un minuto da ora'], ['%s minuti fa', '%s minuti da ora'], ['un\'ora fa', 'un\'ora da ora'], ['%s ore fa', '%s ore da ora'], ['un giorno fa', 'un giorno da ora'], ['%s giorni fa', '%s giorni da ora'], ['una settimana fa', 'una settimana da ora'], ['%s settimane fa', '%s settimane da ora'], ['un mese fa', 'un mese da ora'], ['%s mesi fa', '%s mesi da ora'], ['un anno fa', 'un anno da ora'], ['%s anni fa', '%s anni da ora']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/ja.js b/lib/lang/ja.js new file mode 100644 index 0000000..8e5f794 --- /dev/null +++ b/lib/lang/ja.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['すこし前', 'すぐに'], ['%s秒前', '%s秒以内'], ['1分前', '1分以内'], ['%s分前', '%s分以内'], ['1時間前', '1時間以内'], ['%s時間前', '%s時間以内'], ['1日前', '1日以内'], ['%s日前', '%s日以内'], ['1週間前', '1週間以内'], ['%s週間前', '%s週間以内'], ['1ヶ月前', '1ヶ月以内'], ['%sヶ月前', '%sヶ月以内'], ['1年前', '1年以内'], ['%s年前', '%s年以内']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/ko.js b/lib/lang/ko.js new file mode 100644 index 0000000..171c802 --- /dev/null +++ b/lib/lang/ko.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['방금', '곧'], ['%s초 전', '%s초 후'], ['1분 전', '1분 후'], ['%s분 전', '%s분 후'], ['1시간 전', '1시간 후'], ['%s시간 전', '%s시간 후'], ['1일 전', '1일 후'], ['%s일 전', '%s일 후'], ['1주일 전', '1주일 후'], ['%s주일 전', '%s주일 후'], ['1개월 전', '1개월 후'], ['%s개월 전', '%s개월 후'], ['1년 전', '1년 후'], ['%s년 전', '%s년 후']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/ml.js b/lib/lang/ml.js new file mode 100644 index 0000000..e17030a --- /dev/null +++ b/lib/lang/ml.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['ഇപ്പോള്‍', 'കുറച്ചു മുന്‍പ്'], ['%s സെക്കന്റ്‌കള്‍ക്ക് മുന്‍പ്', '%s സെക്കന്റില്‍'], ['1 മിനിറ്റിനു മുന്‍പ്', '1 മിനിറ്റില്‍'], ['%s മിനിറ്റുകള്‍ക്ക് മുന്‍പ', '%s മിനിറ്റില്‍'], ['1 മണിക്കൂറിനു മുന്‍പ്', '1 മണിക്കൂറില്‍'], ['%s മണിക്കൂറുകള്‍ക്കു മുന്‍പ്', '%s മണിക്കൂറില്‍'], ['1 ഒരു ദിവസം മുന്‍പ്', '1 ദിവസത്തില്‍'], ['%s ദിവസങ്ങള്‍ക് മുന്‍പ്', '%s ദിവസങ്ങള്‍ക്കുള്ളില്‍'], ['1 ആഴ്ച മുന്‍പ്', '1 ആഴ്ചയില്‍'], ['%s ആഴ്ചകള്‍ക്ക് മുന്‍പ്', '%s ആഴ്ചകള്‍ക്കുള്ളില്‍'], ['1 മാസത്തിനു മുന്‍പ്', '1 മാസത്തിനുള്ളില്‍'], ['%s മാസങ്ങള്‍ക്ക് മുന്‍പ്', '%s മാസങ്ങള്‍ക്കുള്ളില്‍'], ['1 വര്‍ഷത്തിനു മുന്‍പ്', '1 വര്‍ഷത്തിനുള്ളില്‍'], ['%s വര്‍ഷങ്ങള്‍ക്കു മുന്‍പ്', '%s വര്‍ഷങ്ങള്‍ക്കുല്ല്ളില്‍']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/my.js b/lib/lang/my.js new file mode 100644 index 0000000..73d8d41 --- /dev/null +++ b/lib/lang/my.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['ယခုအတွင်း', 'ယခု'], ['%s စက္ကန့် အကြာက', '%s စက္ကန့်အတွင်း'], ['1 မိနစ် အကြာက', '1 မိနစ်အတွင်း'], ['%s မိနစ် အကြာက', '%s မိနစ်အတွင်း'], ['1 နာရီ အကြာက', '1 နာရီအတွင်း'], ['%s နာရီ အကြာက', '%s နာရီအတွင်း'], ['1 ရက် အကြာက', '1 ရက်အတွင်း'], ['%s ရက် အကြာက', '%s ရက်အတွင်း'], ['1 ပတ် အကြာက', '1 ပတ်အတွင်း'], ['%s ပတ် အကြာက', '%s ပတ်အတွင်း'], ['1 လ အကြာက', '1 လအတွင်း'], ['%s လ အကြာက', '%s လအတွင်း'], ['1 နှစ် အကြာက', '1 နှစ်အတွင်း'], ['%s နှစ် အကြာက', '%s နှစ်အတွင်း']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/nb_NO.js b/lib/lang/nb_NO.js new file mode 100644 index 0000000..de6d22c --- /dev/null +++ b/lib/lang/nb_NO.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['akkurat nå', 'om litt'], ['%s sekunder siden', 'om %s sekunder'], ['1 minutt siden', 'om 1 minutt'], ['%s minutter siden', 'om %s minutter'], ['1 time siden', 'om 1 time'], ['%s timer siden', 'om %s timer'], ['1 dag siden', 'om 1 dag'], ['%s dager siden', 'om %s dager'], ['1 uke siden', 'om 1 uke'], ['%s uker siden', 'om %s uker'], ['1 måned siden', 'om 1 måned'], ['%s måneder siden', 'om %s måneder'], ['1 år siden', 'om 1 år'], ['%s år siden', 'om %s år']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/nl.js b/lib/lang/nl.js new file mode 100644 index 0000000..9fc5ce1 --- /dev/null +++ b/lib/lang/nl.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['recent', 'binnenkort'], ['%s seconden geleden', 'binnen %s seconden'], ['1 minuut geleden', 'binnen 1 minuut'], ['%s minuten geleden', 'binnen %s minuten'], ['1 uur geleden', 'binnen 1 uur'], ['%s uren geleden', 'binnen %s uren'], ['1 dag geleden', 'binnen 1 dag'], ['%s dagen geleden', 'binnen %s dagen'], ['1 week geleden', 'binnen 1 week'], ['%s weken geleden', 'binnen %s weken'], ['1 maand geleden', 'binnen 1 maand'], ['%s maanden geleden', 'binnen %s maanden'], ['1 jaar geleden', 'binnen 1 jaar'], ['%s jaren geleden', 'binnen %s jaren']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/nn_NO.js b/lib/lang/nn_NO.js new file mode 100644 index 0000000..4d1acfa --- /dev/null +++ b/lib/lang/nn_NO.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['nett no', 'om litt'], ['%s sekund sidan', 'om %s sekund'], ['1 minutt sidan', 'om 1 minutt'], ['%s minutt sidan', 'om %s minutt'], ['1 time sidan', 'om 1 time'], ['%s timar sidan', 'om %s timar'], ['1 dag sidan', 'om 1 dag'], ['%s dagar sidan', 'om %s dagar'], ['1 veke sidan', 'om 1 veke'], ['%s veker sidan', 'om %s veker'], ['1 månad sidan', 'om 1 månad'], ['%s månadar sidan', 'om %s månadar'], ['1 år sidan', 'om 1 år'], ['%s år sidan', 'om %s år']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/pl.js b/lib/lang/pl.js new file mode 100644 index 0000000..f507896 --- /dev/null +++ b/lib/lang/pl.js @@ -0,0 +1,22 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + // to determine which plural form must be used check the last 2 digits + // and calculate new index value to get the nominative form (14-20) + // for all other cases use index value as it is (0-13) + return l[index & 1 ? number % 10 > 4 || number % 10 < 2 || 1 === ~~(number / 10) % 10 ? index : ++index / 2 + 13 : index]; +}; + +// 0-13 alternately: single unit of time, +// genitive plural form for all other numbers excluding cases below: +// 14-20: nominative plural form for the numbers 2,3,4 +// and all other numbers higher than 21 which end in 2,3,4 +var l = [['w tej chwili', 'za chwilę'], ['%s sekund temu', 'za %s sekund'], ['1 minutę temu', 'za 1 minutę'], ['%s minut temu', 'za %s minut'], ['1 godzinę temu', 'za 1 godzinę'], ['%s godzin temu', 'za %s godzin'], ['1 dzień temu', 'za 1 dzień'], // ['wczoraj', 'jutro'], +['%s dni temu', 'za %s dni'], ['1 tydzień temu', 'za 1 tydzień'], ['%s tygodni temu', 'za %s tygodni'], ['1 miesiąc temu', 'za 1 miesiąc'], ['%s miesięcy temu', 'za %s miesięcy'], ['1 rok temu', 'za 1 rok'], ['%s lat temu', 'za %s lat'], ['%s sekundy temu', 'za %s sekundy'], ['%s minuty temu', 'za %s minuty'], ['%s godziny temu', 'za %s godziny'], ['%s dni temu', 'za %s dni'], ['%s tygodnie temu', 'za %s tygodnie'], ['%s miesiące temu', 'za %s miesiące'], ['%s lata temu', 'za %s lata']]; + +; +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/pt_BR.js b/lib/lang/pt_BR.js new file mode 100644 index 0000000..58e4bd3 --- /dev/null +++ b/lib/lang/pt_BR.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['agora mesmo', 'daqui um pouco'], ['há %s segundos', 'em %s segundos'], ['há um minuto', 'em um minuto'], ['há %s minutos', 'em %s minutos'], ['há uma hora', 'em uma hora'], ['há %s horas', 'em %s horas'], ['há um dia', 'em um dia'], ['há %s dias', 'em %s dias'], ['há uma semana', 'em uma semana'], ['há %s semanas', 'em %s semanas'], ['há um mês', 'em um mês'], ['há %s meses', 'em %s meses'], ['há um ano', 'em um ano'], ['há %s anos', 'em %s anos']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/ro.js b/lib/lang/ro.js new file mode 100644 index 0000000..740828a --- /dev/null +++ b/lib/lang/ro.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + var langTable = [['chiar acum', 'chiar acum'], ['acum %s secunde', 'peste %s secunde'], ['acum un minut', 'peste un minut'], ['acum %s minute', 'peste %s minute'], ['acum o oră', 'peste o oră'], ['acum %s ore', 'peste %s ore'], ['acum o zi', 'peste o zi'], ['acum %s zile', 'peste %s zile'], ['acum o săptămână', 'peste o săptămână'], ['acum %s săptămâni', 'peste %s săptămâni'], ['acum o lună', 'peste o lună'], ['acum %s luni', 'peste %s luni'], ['acum un an', 'peste un an'], ['acum %s ani', 'peste %s ani']]; + + if (number < 20) { + return langTable[index]; + } + + // A `de` preposition must be added between the number and the adverb + // if the number is greater than 20. + return [langTable[index][0].replace('%s', '%s de'), langTable[index][1].replace('%s', '%s de')]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/ru.js b/lib/lang/ru.js new file mode 100644 index 0000000..39cd068 --- /dev/null +++ b/lib/lang/ru.js @@ -0,0 +1,70 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + switch (index) { + case 0: + return ['только что', 'через несколько секунд']; + case 1: + return [seconds(number) + ' назад', 'через ' + seconds(number)]; + case 2: // ['минуту назад', 'через минуту']; + case 3: + return [minutes(number) + ' назад', 'через ' + minutes(number)]; + case 4: // ['час назад', 'через час']; + case 5: + return [hours(number) + ' назад', 'через ' + hours(number)]; + case 6: + return ['вчера', 'завтра']; + case 7: + return [days(number) + ' назад', 'через ' + days(number)]; + case 8: // ['неделю назад', 'через неделю']; + case 9: + return [weeks(number) + ' назад', 'через ' + weeks(number)]; + case 10: // ['месяц назад', 'через месяц']; + case 11: + return [months(number) + ' назад', 'через ' + months(number)]; + case 12: // ['год назад', 'через год']; + case 13: + return [years(number) + ' назад', 'через ' + years(number)]; + default: + return ['', '']; + } +}; + +var seconds = formatNum.bind(null, 'секунду', '%s секунду', '%s секунды', '%s секунд'), + minutes = formatNum.bind(null, 'минуту', '%s минуту', '%s минуты', '%s минут'), + hours = formatNum.bind(null, 'час', '%s час', '%s часа', '%s часов'), + days = formatNum.bind(null, 'день', '%s день', '%s дня', '%s дней'), + weeks = formatNum.bind(null, 'неделю', '%s неделю', '%s недели', '%s недель'), + months = formatNum.bind(null, 'месяц', '%s месяц', '%s месяца', '%s месяцев'), + years = formatNum.bind(null, 'год', '%s год', '%s года', '%s лет'); + +; + +/** + * + * @param f1 - 1 + * @param f - 21, 31, ... + * @param s - 2-4, 22-24, 32-34 ... + * @param t - 5-20, 25-30, ... + * @param n + * @returns {string} + */ +function formatNum(f1, f, s, t, n) { + var n10 = n % 10, + str = t; + + if (n === 1) { + str = f1; + } else if (n10 === 1 && n > 20) { + str = f; + } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) { + str = s; + } + + return str; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/sq.js b/lib/lang/sq.js new file mode 100644 index 0000000..c711d3b --- /dev/null +++ b/lib/lang/sq.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['pak më parë', 'pas pak'], ['para %s sekondash', 'pas %s sekondash'], ['para një minute', 'pas një minute'], ['para %s minutash', 'pas %s minutash'], ['para një ore', 'pas një ore'], ['para %s orësh', 'pas %s orësh'], ['dje', 'nesër'], ['para %s ditësh', 'pas %s ditësh'], ['para një jave', 'pas një jave'], ['para %s javësh', 'pas %s javësh'], ['para një muaji', 'pas një muaji'], ['para %s muajsh', 'pas %s muajsh'], ['para një viti', 'pas një viti'], ['para %s vjetësh', 'pas %s vjetësh']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/sr.js b/lib/lang/sr.js new file mode 100644 index 0000000..88ff175 --- /dev/null +++ b/lib/lang/sr.js @@ -0,0 +1,60 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + switch (index) { + case 0: + return ['малопре', 'управо сад']; + case 1: + return ['пре ' + seconds(number), 'за ' + seconds(number)]; + case 2: + case 3: + return ['пре ' + minutes(number), 'за ' + minutes(number)]; + case 4: + case 5: + return ['пре ' + hours(number), 'за ' + hours(number)]; + case 6: + case 7: + return ['пре ' + days(number), 'за ' + days(number)]; + case 8: + case 9: + return ['пре ' + weeks(number), 'за ' + weeks(number)]; + case 10: + case 11: + return ['пре ' + months(number), 'за ' + months(number)]; + case 12: + case 13: + return ['пре ' + years(number), 'за ' + years(number)]; + default: + return ['', '']; + } +}; + +var seconds = formatNum.bind(null, '1 секунд', '%s секунд', '%s секунде', '%s секунди'), + minutes = formatNum.bind(null, '1 минут', '%s минут', '%s минуте', '%s минута'), + hours = formatNum.bind(null, 'сат времена', '%s сат', '%s сата', '%s сати'), + days = formatNum.bind(null, '1 дан', '%s дан', '%s дана', '%s дана'), + weeks = formatNum.bind(null, 'недељу дана', '%s недељу', '%s недеље', '%s недеља'), + months = formatNum.bind(null, 'месец дана', '%s месец', '%s месеца', '%s месеци'), + years = formatNum.bind(null, 'годину дана', '%s годину', '%s године', '%s година'); + +; + +function formatNum(single, one, few, other, n) { + var rem10 = n % 10; + var rem100 = n % 100; + + if (n == 1) { + return single; + } else if (rem10 == 1 && rem100 != 11) { + return one; + } else if (rem10 >= 2 && rem10 <= 4 && !(rem100 >= 12 && rem100 <= 14)) { + return few; + } else { + return other; + } +} +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/sv.js b/lib/lang/sv.js new file mode 100644 index 0000000..d7e1681 --- /dev/null +++ b/lib/lang/sv.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['just nu', 'om en stund'], ['%s sekunder sedan', 'om %s sekunder'], ['1 minut sedan', 'om 1 minut'], ['%s minuter sedan', 'om %s minuter'], ['1 timme sedan', 'om 1 timme'], ['%s timmar sedan', 'om %s timmar'], ['1 dag sedan', 'om 1 dag'], ['%s dagar sedan', 'om %s dagar'], ['1 vecka sedan', 'om 1 vecka'], ['%s veckor sedan', 'om %s veckor'], ['1 månad sedan', 'om 1 månad'], ['%s månader sedan', 'om %s månader'], ['1 år sedan', 'om 1 år'], ['%s år sedan', 'om %s år']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/ta.js b/lib/lang/ta.js new file mode 100644 index 0000000..d5342ab --- /dev/null +++ b/lib/lang/ta.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['இப்போது', 'சற்று நேரம் முன்பு'], ['%s நொடிக்கு முன்', '%s நொடிகளில்'], ['1 நிமிடத்திற்க்கு முன்', '1 நிமிடத்தில்'], ['%s நிமிடத்திற்க்கு முன்', '%s நிமிடங்களில்'], ['1 மணி நேரத்திற்கு முன்', '1 மணி நேரத்திற்குள்'], ['%s மணி நேரத்திற்கு முன்', '%s மணி நேரத்திற்குள்'], ['1 நாளுக்கு முன்', '1 நாளில்'], ['%s நாட்களுக்கு முன்', '%s நாட்களில்'], ['1 வாரத்திற்கு முன்', '1 வாரத்தில்'], ['%s வாரங்களுக்கு முன்', '%s வாரங்களில்'], ['1 மாதத்திற்கு முன்', '1 மாதத்தில்'], ['%s மாதங்களுக்கு முன்', '%s மாதங்களில்'], ['1 வருடத்திற்கு முன்', '1 வருடத்தில்'], ['%s வருடங்களுக்கு முன்', '%s வருடங்களில்']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/th.js b/lib/lang/th.js new file mode 100644 index 0000000..a4d094f --- /dev/null +++ b/lib/lang/th.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['เมื่อสักครู่นี้', 'อีกสักครู่'], ['%s วินาทีที่แล้ว', 'ใน %s วินาที'], ['1 นาทีที่แล้ว', 'ใน 1 นาที'], ['%s นาทีที่แล้ว', 'ใน %s นาที'], ['1 ชั่วโมงที่แล้ว', 'ใน 1 ชั่วโมง'], ['%s ชั่วโมงที่แล้ว', 'ใน %s ชั่วโมง'], ['1 วันที่แล้ว', 'ใน 1 วัน'], ['%s วันที่แล้ว', 'ใน %s วัน'], ['1 อาทิตย์ที่แล้ว', 'ใน 1 อาทิตย์'], ['%s อาทิตย์ที่แล้ว', 'ใน %s อาทิตย์'], ['1 เดือนที่แล้ว', 'ใน 1 เดือน'], ['%s เดือนที่แล้ว', 'ใน %s เดือน'], ['1 ปีที่แล้ว', 'ใน 1 ปี'], ['%s ปีที่แล้ว', 'ใน %s ปี']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/tr.js b/lib/lang/tr.js new file mode 100644 index 0000000..2f46f5c --- /dev/null +++ b/lib/lang/tr.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['az önce', 'şimdi'], ['%s saniye önce', '%s saniye içinde'], ['1 dakika önce', '1 dakika içinde'], ['%s dakika önce', '%s dakika içinde'], ['1 saat önce', '1 saat içinde'], ['%s saat önce', '%s saat içinde'], ['1 gün önce', '1 gün içinde'], ['%s gün önce', '%s gün içinde'], ['1 hafta önce', '1 hafta içinde'], ['%s hafta önce', '%s hafta içinde'], ['1 ay önce', '1 ay içinde'], ['%s ay önce', '%s ay içinde'], ['1 yıl önce', '1 yıl içinde'], ['%s yıl önce', '%s yıl içinde']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/uk.js b/lib/lang/uk.js new file mode 100644 index 0000000..5aa3c51 --- /dev/null +++ b/lib/lang/uk.js @@ -0,0 +1,57 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + switch (index) { + case 0: + return ['щойно', 'через декілька секунд']; + case 1: + return [seconds(number) + ' тому', 'через ' + seconds(number)]; + case 2: + case 3: + return [minutes(number) + ' тому', 'через ' + minutes(number)]; + case 4: + case 5: + return [hours(number) + ' тому', 'через ' + hours(number)]; + case 6: + case 7: + return [days(number) + ' тому', 'через ' + days(number)]; + case 8: + case 9: + return [weeks(number) + ' тому', 'через ' + weeks(number)]; + case 10: + case 11: + return [months(number) + ' тому', 'через ' + months(number)]; + case 12: + case 13: + return [years(number) + ' тому', 'через ' + years(number)]; + default: + return ['', '']; + } +}; + +var seconds = formatNum.bind(null, 'секунду', '%s секунду', '%s секунди', '%s секунд'), + minutes = formatNum.bind(null, 'хвилину', '%s хвилину', '%s хвилини', '%s хвилин'), + hours = formatNum.bind(null, 'годину', '%s годину', '%s години', '%s годин'), + days = formatNum.bind(null, 'день', '%s день', '%s дні', '%s днів'), + weeks = formatNum.bind(null, 'тиждень', '%s тиждень', '%s тиждні', '%s тижднів'), + months = formatNum.bind(null, 'місяць', '%s місяць', '%s місяці', '%s місяців'), + years = formatNum.bind(null, 'рік', '%s рік', '%s роки', '%s років'); + +function formatNum(f1, f, s, t, n) { + var n10 = n % 10, + str = t; + + if (n === 1) { + str = f1; + } else if (n10 === 1 && n > 20) { + str = f; + } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) { + str = s; + } + return str; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/vi.js b/lib/lang/vi.js new file mode 100644 index 0000000..b0ecdd1 --- /dev/null +++ b/lib/lang/vi.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['vừa xong', 'một lúc'], ['%s giây trước', 'trong %s giây'], ['1 phút trước', 'trong 1 phút'], ['%s phút trước', 'trong %s phút'], ['1 giờ trước', 'trong 1 giờ'], ['%s giờ trước', 'trong %s giờ'], ['1 ngày trước', 'trong 1 ngày'], ['%s ngày trước', 'trong %s ngày'], ['1 tuần trước', 'trong 1 tuần'], ['%s tuần trước', 'trong %s tuần'], ['1 tháng trước', 'trong 1 tháng'], ['%s tháng trước', 'trong %s tháng'], ['1 năm trước', 'trong 1 năm'], ['%s năm trước', 'trong %s năm']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/zh_CN.js b/lib/lang/zh_CN.js new file mode 100644 index 0000000..d1a75c9 --- /dev/null +++ b/lib/lang/zh_CN.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['刚刚', '片刻后'], ['%s秒前', '%s秒后'], ['1分钟前', '1分钟后'], ['%s分钟前', '%s分钟后'], ['1小时前', '1小时后'], ['%s小时前', '%s小时后'], ['1天前', '1天后'], ['%s天前', '%s天后'], ['1周前', '1周后'], ['%s周前', '%s周后'], ['1月前', '1月后'], ['%s月前', '%s月后'], ['1年前', '1年后'], ['%s年前', '%s年后']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/lang/zh_TW.js b/lib/lang/zh_TW.js new file mode 100644 index 0000000..f1cc3a5 --- /dev/null +++ b/lib/lang/zh_TW.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (number, index) { + return [['剛剛', '片刻後'], ['%s秒前', '%s秒後'], ['1分鐘前', '1分鐘後'], ['%s分鐘前', '%s分鐘後'], ['1小時前', '1小時後'], ['%s小時前', '%s小時後'], ['1天前', '1天後'], ['%s天前', '%s天後'], ['1周前', '1周後'], ['%s周前', '%s周後'], ['1月前', '1月後'], ['%s月前', '%s月後'], ['1年前', '1年後'], ['%s年前', '%s年後']][index]; +}; + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/localesEntry.js b/lib/localesEntry.js new file mode 100644 index 0000000..d1fb841 --- /dev/null +++ b/lib/localesEntry.js @@ -0,0 +1,37 @@ +'use strict'; + +var _lang = require('./lang'); + +var _lang2 = _interopRequireDefault(_lang); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _iteratorNormalCompletion = true; /** + * Created by hustcc on 18/5/20. + * Contract: i@hust.cc + */ + +var _didIteratorError = false; +var _iteratorError = undefined; + +try { + + for (var _iterator = Object.keys(_lang2.default)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var locale = _step.value; + + timeago.register(locale, _lang2.default[locale]); + } +} catch (err) { + _didIteratorError = true; + _iteratorError = err; +} finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } +} \ No newline at end of file diff --git a/locales/index.js b/locales/index.js deleted file mode 100644 index ba3b5a3..0000000 --- a/locales/index.js +++ /dev/null @@ -1,6 +0,0 @@ -/** locales table. - * You can add the missing locale code - * 1. please sort by dictionary. - * 2. please ensure the accuracy. - */ -module.exports = [ 'ar', 'be', 'bg', 'ca', 'da', 'de', 'el', 'en', 'en_short', 'es', 'eu', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'in_BG', 'in_HI', 'in_ID', 'it', 'ja', 'ko', 'ml', 'my', 'nb_NO', 'nl', 'nn_NO', 'pl', 'pt_BR', 'ro', 'ru', 'sq', 'sr', 'sv', 'ta', 'th', 'tr', 'uk', 'vi', 'zh_CN', 'zh_TW' ]; diff --git a/package.json b/package.json index bba79b1..b2a40e4 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "test": "NODE_ENV=babel jest", "coveralls": "cat ./coverage/lcov.info | coveralls", - "build:umd": "rimraf ./dist && cross-env NODE_ENV=rollup rollup -c", + "build:umd": "rimraf ./dist && cross-env NODE_ENV=rollup rollup -c && cross-env NODE_ENV=rollup rollup -c rollup.config.locales.js", "build:lib": "rimraf ./lib && cross-env NODE_ENV=babel babel src -d lib", "build": "npm run build:umd && npm run build:lib && npm run test" }, @@ -33,7 +33,8 @@ "url": "https://github.com/hustcc/timeago.js/issues" }, "dependencies": { - "@types/jquery": "^2.0.40" + "@types/jquery": "^2.0.40", + "rollup-plugin-node-resolve": "^3.3.0" }, "devDependencies": { "babel-cli": "^6.26.0", diff --git a/rollup.config.js b/rollup.config.js index 20aee3a..da9d25f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,9 +7,12 @@ import uglify from 'rollup-plugin-uglify'; import babel from 'rollup-plugin-babel'; export default { - entry: 'src/index.js', - format: 'umd', - name: 'timeago', + input: 'src/index.js', + output: { + file: 'dist/timeago.min.js', + name: 'timeago', + format: 'umd', + }, plugins: [ babel({ exclude: 'node_modules/**', @@ -19,5 +22,4 @@ export default { compress: { warnings: false } }), ], - dest: 'dist/timeago.min.js' }; diff --git a/rollup.config.locales.js b/rollup.config.locales.js new file mode 100644 index 0000000..81d047a --- /dev/null +++ b/rollup.config.locales.js @@ -0,0 +1,26 @@ +/** + * Created by hustcc on 18/5/20. + * Contract: i@hust.cc + */ + +import uglify from 'rollup-plugin-uglify'; +import babel from 'rollup-plugin-babel'; +import resolve from 'rollup-plugin-node-resolve'; + +export default { + input: 'src/localesEntry.js', + output: { + file: 'dist/timeago.locales.min.js', + format: 'iife', + }, + plugins: [ + resolve(), + babel({ + exclude: 'node_modules/**', + }), + uglify({ + output: { comments: false }, + compress: { warnings: false } + }), + ], +}; diff --git a/src/index.js b/src/index.js index a2df289..45aa0e4 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,7 @@ */ import { TimeAgo } from './TimeAgo'; -import { register } from './locales' +import { Locales, register } from './locales' import { cancel } from './timer'; // 入口函数 diff --git a/locales/ar.js b/src/lang/ar.js similarity index 95% rename from locales/ar.js rename to src/lang/ar.js index f010cfe..09eb9f9 100644 --- a/locales/ar.js +++ b/src/lang/ar.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { if (index === 0) { return [ 'منذ لحظات', 'بعد لحظات' ]; } @@ -24,4 +24,4 @@ function formatTime(type, n) { return timeTypes[type][2]; else return timeTypes[type][3]; -} \ No newline at end of file +} diff --git a/locales/be.js b/src/lang/be.js similarity index 97% rename from locales/be.js rename to src/lang/be.js index e397991..7bb459b 100644 --- a/locales/be.js +++ b/src/lang/be.js @@ -6,7 +6,7 @@ var seconds = formatNum.bind(null, 'секунду', '%s секунду', '%s с months = formatNum.bind(null, 'месяц', '%s месяц', '%s месяцы', '%s месяцаў'), years = formatNum.bind(null, 'год', '%s год', '%s гады', '%s гадоў'); -module.exports = function(number, index) { +export default function(number, index) { switch(index) { case 0: return ['толькі што', 'праз некалькі секунд']; case 1: return [seconds(number) + ' таму', 'праз ' + seconds(number)]; diff --git a/locales/bg.js b/src/lang/bg.js similarity index 95% rename from locales/bg.js rename to src/lang/bg.js index 3ef7ad1..8e6b5cf 100644 --- a/locales/bg.js +++ b/src/lang/bg.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['току що', 'съвсем скоро'], ['преди %s секунди', 'след %s секунди'], diff --git a/locales/ca.js b/src/lang/ca.js similarity index 93% rename from locales/ca.js rename to src/lang/ca.js index 2104e2c..e15651b 100644 --- a/locales/ca.js +++ b/src/lang/ca.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['fa un moment', 'd\'aquí un moment'], ['fa %s segons', 'd\'aquí %s segons'], diff --git a/locales/da.js b/src/lang/da.js similarity index 93% rename from locales/da.js rename to src/lang/da.js index 82a0a2e..648b9bf 100644 --- a/locales/da.js +++ b/src/lang/da.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['for et øjeblik siden', 'om et øjeblik'], ['for %s sekunder siden', 'om %s sekunder'], diff --git a/locales/de.js b/src/lang/de.js similarity index 92% rename from locales/de.js rename to src/lang/de.js index d101781..cbce5b9 100644 --- a/locales/de.js +++ b/src/lang/de.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['gerade eben', 'vor einer Weile'], ['vor %s Sekunden', 'in %s Sekunden'], diff --git a/locales/el.js b/src/lang/el.js similarity index 94% rename from locales/el.js rename to src/lang/el.js index ade27ba..ebfaf39 100644 --- a/locales/el.js +++ b/src/lang/el.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['μόλις τώρα', 'σε λίγο'], ['%s δευτερόλεπτα πριν', 'σε %s δευτερόλεπτα'], diff --git a/locales/en.js b/src/lang/en.js similarity index 92% rename from locales/en.js rename to src/lang/en.js index fe60c2b..f7d3d36 100644 --- a/locales/en.js +++ b/src/lang/en.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['just now', 'right now'], ['%s seconds ago', 'in %s seconds'], diff --git a/locales/en_short.js b/src/lang/en_short.js similarity index 90% rename from locales/en_short.js rename to src/lang/en_short.js index 98015f8..84e9e52 100644 --- a/locales/en_short.js +++ b/src/lang/en_short.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['just now', 'right now'], ['%ss ago', 'in %ss'], @@ -15,4 +15,4 @@ module.exports = function(number, index) { ['1yr ago', 'in 1yr'], ['%syr ago', 'in %syr'] ][index]; -} \ No newline at end of file +} diff --git a/locales/es.js b/src/lang/es.js similarity index 92% rename from locales/es.js rename to src/lang/es.js index a88eb6e..c7e05fb 100644 --- a/locales/es.js +++ b/src/lang/es.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['justo ahora', 'en un rato'], ['hace %s segundos', 'en %s segundos'], @@ -15,4 +15,4 @@ module.exports = function(number, index) { ['hace 1 año', 'en 1 año'], ['hace %s años', 'en %s años'] ][index]; -}; \ No newline at end of file +}; diff --git a/locales/eu.js b/src/lang/eu.js similarity index 93% rename from locales/eu.js rename to src/lang/eu.js index 2a73698..c25158a 100644 --- a/locales/eu.js +++ b/src/lang/eu.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['orain', 'denbora bat barru'], ['duela %s segundu', '%s segundu barru'], diff --git a/locales/fa.js b/src/lang/fa.js similarity index 95% rename from locales/fa.js rename to src/lang/fa.js index ef7c58e..9424ee9 100644 --- a/locales/fa.js +++ b/src/lang/fa.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['همین الآن', 'لحظاتی پیش'], ['%s ثانیه پیش', 'حدود %s ثانیه پیش'], diff --git a/locales/fi.js b/src/lang/fi.js similarity index 94% rename from locales/fi.js rename to src/lang/fi.js index 609dbb6..162be0e 100644 --- a/locales/fi.js +++ b/src/lang/fi.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['juuri äsken', 'juuri nyt'], ['%s sekuntia sitten', '%s sekunnin päästä'], diff --git a/locales/fr.js b/src/lang/fr.js similarity index 93% rename from locales/fr.js rename to src/lang/fr.js index 0576c17..72f435d 100644 --- a/locales/fr.js +++ b/src/lang/fr.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['à l\'instant', 'dans un instant'], ['il y a %s secondes', 'dans %s secondes'], @@ -15,4 +15,4 @@ module.exports = function(number, index) { ['il y a 1 an', 'dans 1 an'], ['il y a %s ans', 'dans %s ans'] ][index]; -} \ No newline at end of file +} diff --git a/locales/gl.js b/src/lang/gl.js similarity index 92% rename from locales/gl.js rename to src/lang/gl.js index 078d100..2ef23b3 100644 --- a/locales/gl.js +++ b/src/lang/gl.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['xusto agora', 'daquí a un pouco'], ['hai %s segundos', 'en %s segundos'], diff --git a/locales/he.js b/src/lang/he.js similarity index 94% rename from locales/he.js rename to src/lang/he.js index 27c0075..4321fa4 100644 --- a/locales/he.js +++ b/src/lang/he.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['זה עתה', 'עכשיו'], ['לפני %s שניות', 'בעוד %s שניות'], diff --git a/locales/hu.js b/src/lang/hu.js similarity index 92% rename from locales/hu.js rename to src/lang/hu.js index 1d08bc4..9e936ee 100644 --- a/locales/hu.js +++ b/src/lang/hu.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['éppen most', 'éppen most'], ['%s másodperce', '%s másodpercen belül'], diff --git a/locales/in_BG.js b/src/lang/in_BG.js similarity index 93% rename from locales/in_BG.js rename to src/lang/in_BG.js index a6f44f0..edac732 100644 --- a/locales/in_BG.js +++ b/src/lang/in_BG.js @@ -1,5 +1,5 @@ -module.exports = function(number, index) { - return [ +export default function(number, index) { + return [ [ 'এইমাত্র' , 'একটা সময়'] , [ '%s সেকেন্ড আগে', '%s এর সেকেন্ডের মধ্যে'] , [ '1 মিনিট আগে', '1 মিনিটে'] , diff --git a/locales/in_HI.js b/src/lang/in_HI.js similarity index 94% rename from locales/in_HI.js rename to src/lang/in_HI.js index 479adfc..5e3d918 100644 --- a/locales/in_HI.js +++ b/src/lang/in_HI.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['अभी', 'कुछ समय'], ['%s सेकंड पहले', '%s सेकंड में'], diff --git a/locales/in_ID.js b/src/lang/in_ID.js similarity index 93% rename from locales/in_ID.js rename to src/lang/in_ID.js index 2d4f5f1..63a5f45 100644 --- a/locales/in_ID.js +++ b/src/lang/in_ID.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['baru saja', 'sebentar'], ['%s detik yang lalu', 'dalam %s detik'], diff --git a/src/lang/index.js b/src/lang/index.js new file mode 100644 index 0000000..3f59f86 --- /dev/null +++ b/src/lang/index.js @@ -0,0 +1,86 @@ + +import ar from './ar'; +import be from './be'; +import bg from './bg'; +import ca from './ca'; +import de from './de'; +import el from './el'; +import en from './en'; +import en_short from './en_short'; +import es from './es'; +import eu from './eu'; +import fa from './fa'; +import fi from './fi'; +import fr from './fr'; +import gl from './gl'; +import he from './he'; +import hu from './hu'; +import in_BG from './in_BG'; +import in_HI from './in_HI'; +import in_ID from './in_ID'; +import it from './it'; +import ja from './ja'; +import ko from './ko'; +import ml from './ml'; +import my from './my'; +import nb_NO from './nb_NO'; +import nl from './nl'; +import nn_NO from './nn_NO'; +import pl from './pl'; +import pt_BR from './pt_BR'; +import ro from './ro'; +import ru from './ru'; +import sq from './sq'; +import sr from './sr'; +import sv from './sv'; +import ta from './ta'; +import th from './th'; +import tr from './tr'; +import uk from './uk'; +import vi from './vi'; +import zh_CN from './zh_CN'; +import zh_TW from './zh_TW'; + +export default { + ar, + be, + bg, + ca, + de, + el, + en, + en_short, + es, + eu, + fa, + fi, + fr, + gl, + he, + hu, + in_BG, + in_HI, + in_ID, + it, + ja, + ko, + ml, + my, + nb_NO, + nl, + nn_NO, + pl, + pt_BR, + ro, + ru, + sq, + sr, + sv, + ta, + th, + tr, + uk, + vi, + zh_CN, + zh_TW +}; diff --git a/locales/it.js b/src/lang/it.js similarity index 93% rename from locales/it.js rename to src/lang/it.js index 5546c7b..d96860f 100644 --- a/locales/it.js +++ b/src/lang/it.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['poco fa', 'tra poco'], ['%s secondi fa', '%s secondi da ora'], diff --git a/locales/ja.js b/src/lang/ja.js similarity index 92% rename from locales/ja.js rename to src/lang/ja.js index 33ca91e..ca6714f 100644 --- a/locales/ja.js +++ b/src/lang/ja.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['すこし前', 'すぐに'], ['%s秒前', '%s秒以内'], diff --git a/locales/ko.js b/src/lang/ko.js similarity index 91% rename from locales/ko.js rename to src/lang/ko.js index 5845bac..00f3a93 100644 --- a/locales/ko.js +++ b/src/lang/ko.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['방금', '곧'], ['%s초 전', '%s초 후'], @@ -15,4 +15,4 @@ module.exports = function(number, index) { ['1년 전', '1년 후'], ['%s년 전', '%s년 후'] ][index]; -} \ No newline at end of file +} diff --git a/locales/ml.js b/src/lang/ml.js similarity index 97% rename from locales/ml.js rename to src/lang/ml.js index b1fa310..ac02beb 100644 --- a/locales/ml.js +++ b/src/lang/ml.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['ഇപ്പോള്‍', 'കുറച്ചു മുന്‍പ്'], ['%s സെക്കന്റ്‌കള്‍ക്ക് മുന്‍പ്', '%s സെക്കന്റില്‍'], diff --git a/locales/my.js b/src/lang/my.js similarity index 96% rename from locales/my.js rename to src/lang/my.js index ed63491..521180e 100644 --- a/locales/my.js +++ b/src/lang/my.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['ယခုအတွင်း', 'ယခု'], ['%s စက္ကန့် အကြာက', '%s စက္ကန့်အတွင်း'], diff --git a/locales/nb_NO.js b/src/lang/nb_NO.js similarity index 90% rename from locales/nb_NO.js rename to src/lang/nb_NO.js index e60c3ef..caf890a 100644 --- a/locales/nb_NO.js +++ b/src/lang/nb_NO.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['akkurat nå', 'om litt'], ['%s sekunder siden', 'om %s sekunder'], diff --git a/locales/nl.js b/src/lang/nl.js similarity index 93% rename from locales/nl.js rename to src/lang/nl.js index aea2e26..f90eb0e 100644 --- a/locales/nl.js +++ b/src/lang/nl.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['recent', 'binnenkort'], ['%s seconden geleden', 'binnen %s seconden'], diff --git a/locales/nn_NO.js b/src/lang/nn_NO.js similarity index 89% rename from locales/nn_NO.js rename to src/lang/nn_NO.js index c2a6324..6fc9e8c 100644 --- a/locales/nn_NO.js +++ b/src/lang/nn_NO.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['nett no', 'om litt'], ['%s sekund sidan', 'om %s sekund'], diff --git a/locales/pl.js b/src/lang/pl.js similarity index 96% rename from locales/pl.js rename to src/lang/pl.js index 2ca74c8..ca3edd0 100644 --- a/locales/pl.js +++ b/src/lang/pl.js @@ -26,7 +26,7 @@ var l = [ ['%s lata temu', 'za %s lata'] ]; -module.exports = function(number, index) { +export default function(number, index) { // to determine which plural form must be used check the last 2 digits // and calculate new index value to get the nominative form (14-20) // for all other cases use index value as it is (0-13) diff --git a/locales/pt_BR.js b/src/lang/pt_BR.js similarity index 92% rename from locales/pt_BR.js rename to src/lang/pt_BR.js index 2f76165..412aacd 100644 --- a/locales/pt_BR.js +++ b/src/lang/pt_BR.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['agora mesmo', 'daqui um pouco'], ['há %s segundos', 'em %s segundos'], diff --git a/locales/ro.js b/src/lang/ro.js similarity index 95% rename from locales/ro.js rename to src/lang/ro.js index f01a16d..a1061a5 100644 --- a/locales/ro.js +++ b/src/lang/ro.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { var langTable = [ ['chiar acum', 'chiar acum'], ['acum %s secunde', 'peste %s secunde'], diff --git a/locales/ru.js b/src/lang/ru.js similarity index 98% rename from locales/ru.js rename to src/lang/ru.js index 8431e2e..0917693 100644 --- a/locales/ru.js +++ b/src/lang/ru.js @@ -6,7 +6,7 @@ var seconds = formatNum.bind(null, 'секунду', '%s секунду', '%s с months = formatNum.bind(null, 'месяц', '%s месяц', '%s месяца', '%s месяцев'), years = formatNum.bind(null, 'год', '%s год', '%s года', '%s лет'); -module.exports = function(number, index) { +export default function(number, index) { switch(index) { case 0: return ['только что', 'через несколько секунд']; case 1: return [seconds(number) + ' назад', 'через ' + seconds(number)]; diff --git a/locales/sq.js b/src/lang/sq.js similarity index 93% rename from locales/sq.js rename to src/lang/sq.js index ba44527..89f7281 100644 --- a/locales/sq.js +++ b/src/lang/sq.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['pak më parë', 'pas pak'], ['para %s sekondash', 'pas %s sekondash'], diff --git a/locales/sr.js b/src/lang/sr.js similarity index 97% rename from locales/sr.js rename to src/lang/sr.js index f1047c1..0c8587a 100644 --- a/locales/sr.js +++ b/src/lang/sr.js @@ -6,7 +6,7 @@ var seconds = formatNum.bind(null, '1 секунд', '%s секунд', '%s се months = formatNum.bind(null, 'месец дана', '%s месец', '%s месеца', '%s месеци'), years = formatNum.bind(null, 'годину дана', '%s годину', '%s године', '%s година'); -module.exports = function(number, index) { +export default function(number, index) { switch(index) { case 0: return ['малопре', 'управо сад']; case 1: return ['пре ' + seconds(number), 'за ' + seconds(number)]; diff --git a/locales/sv.js b/src/lang/sv.js similarity index 92% rename from locales/sv.js rename to src/lang/sv.js index 3bf7122..f9f4f6d 100644 --- a/locales/sv.js +++ b/src/lang/sv.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['just nu', 'om en stund'], ['%s sekunder sedan', 'om %s sekunder'], diff --git a/locales/ta.js b/src/lang/ta.js similarity index 96% rename from locales/ta.js rename to src/lang/ta.js index 22da88a..32ecfcc 100644 --- a/locales/ta.js +++ b/src/lang/ta.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['இப்போது', 'சற்று நேரம் முன்பு'], ['%s நொடிக்கு முன்', '%s நொடிகளில்'], @@ -15,4 +15,4 @@ module.exports = function(number, index) { ['1 வருடத்திற்கு முன்', '1 வருடத்தில்'], ['%s வருடங்களுக்கு முன்', '%s வருடங்களில்'] ][index]; -} \ No newline at end of file +} diff --git a/locales/th.js b/src/lang/th.js similarity index 96% rename from locales/th.js rename to src/lang/th.js index f528a17..9b5e7aa 100644 --- a/locales/th.js +++ b/src/lang/th.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['เมื่อสักครู่นี้', 'อีกสักครู่'], ['%s วินาทีที่แล้ว', 'ใน %s วินาที'], diff --git a/locales/tr.js b/src/lang/tr.js similarity index 93% rename from locales/tr.js rename to src/lang/tr.js index bfdec59..1f7ed19 100644 --- a/locales/tr.js +++ b/src/lang/tr.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['az önce', 'şimdi'], ['%s saniye önce', '%s saniye içinde'], diff --git a/locales/uk.js b/src/lang/uk.js similarity index 97% rename from locales/uk.js rename to src/lang/uk.js index 4519f7b..5d0a1af 100644 --- a/locales/uk.js +++ b/src/lang/uk.js @@ -6,7 +6,7 @@ var seconds = formatNum.bind(null, 'секунду', '%s секунду', '%s с months = formatNum.bind(null, 'місяць', '%s місяць', '%s місяці', '%s місяців'), years = formatNum.bind(null, 'рік', '%s рік', '%s роки', '%s років') -module.exports = function (number, index) { +export default function (number, index) { switch (index) { case 0: return ['щойно', 'через декілька секунд'] case 1: return [seconds(number) + ' тому', 'через ' + seconds(number)] @@ -38,4 +38,4 @@ function formatNum(f1, f, s, t, n) { str = s } return str -} \ No newline at end of file +} diff --git a/locales/vi.js b/src/lang/vi.js similarity index 93% rename from locales/vi.js rename to src/lang/vi.js index 178051b..6e58cd3 100644 --- a/locales/vi.js +++ b/src/lang/vi.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['vừa xong', 'một lúc'], ['%s giây trước', 'trong %s giây'], diff --git a/locales/zh_CN.js b/src/lang/zh_CN.js similarity index 91% rename from locales/zh_CN.js rename to src/lang/zh_CN.js index 8f31425..a9db7cd 100644 --- a/locales/zh_CN.js +++ b/src/lang/zh_CN.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['刚刚', '片刻后'], ['%s秒前', '%s秒后'], @@ -15,4 +15,4 @@ module.exports = function(number, index) { ['1年前', '1年后'], ['%s年前', '%s年后'] ][index]; -} \ No newline at end of file +} diff --git a/locales/zh_TW.js b/src/lang/zh_TW.js similarity index 91% rename from locales/zh_TW.js rename to src/lang/zh_TW.js index 0572809..1097f53 100644 --- a/locales/zh_TW.js +++ b/src/lang/zh_TW.js @@ -1,4 +1,4 @@ -module.exports = function(number, index) { +export default function(number, index) { return [ ['剛剛', '片刻後'], ['%s秒前', '%s秒後'], @@ -15,4 +15,4 @@ module.exports = function(number, index) { ['1年前', '1年後'], ['%s年前', '%s年後'] ][index]; -} \ No newline at end of file +} diff --git a/src/localesEntry.js b/src/localesEntry.js new file mode 100644 index 0000000..e4ac1ac --- /dev/null +++ b/src/localesEntry.js @@ -0,0 +1,10 @@ +/** + * Created by hustcc on 18/5/20. + * Contract: i@hust.cc + */ + +import Languages from './lang'; + +for (const locale of Object.keys(Languages)) { + timeago.register(locale, Languages[locale]); +}