timeago_js 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/assets/javascripts/timeago.js +258 -0
  3. data/assets/javascripts/timeago.locales.js +1 -0
  4. data/assets/javascripts/timeago/locales/ar.js +30 -0
  5. data/assets/javascripts/timeago/locales/be.js +55 -0
  6. data/assets/javascripts/timeago/locales/bg.js +18 -0
  7. data/assets/javascripts/timeago/locales/ca.js +18 -0
  8. data/assets/javascripts/timeago/locales/da.js +18 -0
  9. data/assets/javascripts/timeago/locales/de.js +18 -0
  10. data/assets/javascripts/timeago/locales/el.js +18 -0
  11. data/assets/javascripts/timeago/locales/en.js +18 -0
  12. data/assets/javascripts/timeago/locales/en_short.js +18 -0
  13. data/assets/javascripts/timeago/locales/es.js +18 -0
  14. data/assets/javascripts/timeago/locales/eu.js +18 -0
  15. data/assets/javascripts/timeago/locales/fi.js +18 -0
  16. data/assets/javascripts/timeago/locales/fr.js +18 -0
  17. data/assets/javascripts/timeago/locales/he.js +18 -0
  18. data/assets/javascripts/timeago/locales/hu.js +18 -0
  19. data/assets/javascripts/timeago/locales/in_BG.js +18 -0
  20. data/assets/javascripts/timeago/locales/in_HI.js +18 -0
  21. data/assets/javascripts/timeago/locales/in_ID.js +18 -0
  22. data/assets/javascripts/timeago/locales/it.js +18 -0
  23. data/assets/javascripts/timeago/locales/ja.js +18 -0
  24. data/assets/javascripts/timeago/locales/ko.js +18 -0
  25. data/assets/javascripts/timeago/locales/ml.js +18 -0
  26. data/assets/javascripts/timeago/locales/nb_NO.js +18 -0
  27. data/assets/javascripts/timeago/locales/nl.js +18 -0
  28. data/assets/javascripts/timeago/locales/nn_NO.js +18 -0
  29. data/assets/javascripts/timeago/locales/pl.js +38 -0
  30. data/assets/javascripts/timeago/locales/pt_BR.js +18 -0
  31. data/assets/javascripts/timeago/locales/ro.js +29 -0
  32. data/assets/javascripts/timeago/locales/ru.js +55 -0
  33. data/assets/javascripts/timeago/locales/sv.js +18 -0
  34. data/assets/javascripts/timeago/locales/ta.js +18 -0
  35. data/assets/javascripts/timeago/locales/th.js +18 -0
  36. data/assets/javascripts/timeago/locales/tr.js +18 -0
  37. data/assets/javascripts/timeago/locales/uk.js +44 -0
  38. data/assets/javascripts/timeago/locales/vi.js +18 -0
  39. data/assets/javascripts/timeago/locales/zh_CN.js +18 -0
  40. data/assets/javascripts/timeago/locales/zh_TW.js +18 -0
  41. data/lib/timeago_js.rb +4 -0
  42. data/lib/timeago_js/engine.rb +9 -0
  43. data/lib/timeago_js/version.rb +5 -0
  44. metadata +142 -0
@@ -0,0 +1,18 @@
1
+ this.timeago.register('en', function(number, index) {
2
+ return [
3
+ ['just now', 'right now'],
4
+ ['%s seconds ago', 'in %s seconds'],
5
+ ['1 minute ago', 'in 1 minute'],
6
+ ['%s minutes ago', 'in %s minutes'],
7
+ ['1 hour ago', 'in 1 hour'],
8
+ ['%s hours ago', 'in %s hours'],
9
+ ['1 day ago', 'in 1 day'],
10
+ ['%s days ago', 'in %s days'],
11
+ ['1 week ago', 'in 1 week'],
12
+ ['%s weeks ago', 'in %s weeks'],
13
+ ['1 month ago', 'in 1 month'],
14
+ ['%s months ago', 'in %s months'],
15
+ ['1 year ago', 'in 1 year'],
16
+ ['%s years ago', 'in %s years']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('en_short', function(number, index) {
2
+ return [
3
+ ['just now', 'right now'],
4
+ ['%ss ago', 'in %ss'],
5
+ ['1m ago', 'in 1m'],
6
+ ['%sm ago', 'in %sm'],
7
+ ['1h ago', 'in 1h'],
8
+ ['%sh ago', 'in %sh'],
9
+ ['1d ago', 'in 1d'],
10
+ ['%sd ago', 'in %sd'],
11
+ ['1w ago', 'in 1w'],
12
+ ['%sw ago', 'in %sw'],
13
+ ['1mo ago', 'in 1mo'],
14
+ ['%smo ago', 'in %smo'],
15
+ ['1yr ago', 'in 1yr'],
16
+ ['%syr ago', 'in %syr']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('es', function(number, index) {
2
+ return [
3
+ ['justo ahora', 'en un rato'],
4
+ ['hace %s segundos', 'en %s segundos'],
5
+ ['hace 1 minuto', 'en 1 minuto'],
6
+ ['hace %s minutos', 'en %s minutos'],
7
+ ['hace 1 hora', 'en 1 hora'],
8
+ ['hace %s horas', 'en %s horas'],
9
+ ['hace 1 día', 'en 1 día'],
10
+ ['hace %s días', 'en %s días'],
11
+ ['hace 1 semana', 'en 1 semana'],
12
+ ['hace %s semanas', 'en %s semanas'],
13
+ ['hace 1 mes', 'en 1 mes'],
14
+ ['hace %s meses', 'en %s meses'],
15
+ ['hace 1 año', 'en 1 año'],
16
+ ['hace %s años', 'en %s años']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('eu', function(number, index) {
2
+ return [
3
+ ['orain', 'denbora bat barru'],
4
+ ['duela %s segundu', '%s segundu barru'],
5
+ ['duela minutu 1', 'minutu 1 barru'],
6
+ ['duela %s minutu', '%s minutu barru'],
7
+ ['duela ordu 1', 'ordu 1 barru'],
8
+ ['duela %s ordu', '%s ordu barru'],
9
+ ['duela egun 1', 'egun 1 barru'],
10
+ ['duela %s egun', '%s egun barru'],
11
+ ['duela aste 1', 'aste 1 barru'],
12
+ ['duela %s aste', '%s aste barru'],
13
+ ['duela hillabete 1', 'hillabete 1 barru'],
14
+ ['duela %s hillabete', '%s hillabete barru'],
15
+ ['duela urte 1', 'urte 1 barru'],
16
+ ['duela %s urte', '%s urte barru']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('fi', function(number, index) {
2
+ return [
3
+ ['juuri äsken', 'juuri nyt'],
4
+ ['%s sekuntia sitten', '%s sekunnin päästä'],
5
+ ['minuutti sitten', 'minuutin päästä'],
6
+ ['%s minuuttia sitten', '%s minuutin päästä'],
7
+ ['tunti sitten', 'tunnin päästä'],
8
+ ['%s tuntia sitten', '%s tunnin päästä'],
9
+ ['päivä sitten', 'päivän päästä'],
10
+ ['%s päivää sitten', '%s päivän päästä'],
11
+ ['viikko sitten', 'viikon päästä'],
12
+ ['%s viikkoa sitten', '%s viikon päästä'],
13
+ ['kuukausi sitten', 'kuukauden päästä'],
14
+ ['%s kuukautta sitten', '%s kuukauden päästä'],
15
+ ['vuosi sitten', 'vuoden päästä'],
16
+ ['%s vuotta sitten', '%s vuoden päästä']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('fr', function(number, index) {
2
+ return [
3
+ ['à l\'instant', 'dans un instant'],
4
+ ['il y a %s secondes', 'dans %s secondes'],
5
+ ['il y a 1 minute', 'dans 1 minute'],
6
+ ['il y a %s minutes', 'dans %s minutes'],
7
+ ['il y a 1 heure', 'dans 1 heure'],
8
+ ['il y a %s heures', 'dans %s heures'],
9
+ ['il y a 1 jour', 'dans 1 jour'],
10
+ ['il y a %s jours', 'dans %s jours'],
11
+ ['il y a 1 semaine', 'dans 1 semaine'],
12
+ ['il y a %s semaines', 'dans %s semaines'],
13
+ ['il y a 1 mois', 'dans 1 mois'],
14
+ ['il y a %s mois', 'dans %s mois'],
15
+ ['il y a 1 an', 'dans 1 an'],
16
+ ['il y a %s ans', 'dans %s ans']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('he', function(number, index) {
2
+ return [
3
+ ['זה עתה', 'עכשיו'],
4
+ ['לפני %s שניות', 'בעוד %s שניות'],
5
+ ['לפני דקה', 'בעוד דקה'],
6
+ ['לפני %s דקות', 'בעוד %s דקות'],
7
+ ['לפני שעה', 'בעוד שעה'],
8
+ ['לפני %s שעות', 'בעוד %s שעות'],
9
+ ['אתמול', 'מחר'],
10
+ ['לפני %s ימים', 'בעוד %s ימים'],
11
+ ['לפני שבוע', 'בעוד שבוע'],
12
+ ['לפני %s שבועות', 'בעוד %s שבועות'],
13
+ ['לפני חודש', 'בעוד חודש'],
14
+ ['לפני %s חודשים', 'בעוד %s חודשים'],
15
+ ['לפני שנה', 'בעוד שנה'],
16
+ ['לפני %s שנים', 'בעוד %s שנים']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('hu', function(number, index) {
2
+ return [
3
+ ['éppen most', 'éppen most'],
4
+ ['%s másodperce', '%s másodpercen belül'],
5
+ ['1 perce', '1 percen belül'],
6
+ ['%s perce', '%s percen belül'],
7
+ ['1 órája', '1 órán belül'],
8
+ ['%s órája', '%s órán belül'],
9
+ ['1 napja', '1 napon belül'],
10
+ ['%s napja', '%s napon belül'],
11
+ ['1 hete', '1 héten belül'],
12
+ ['%s hete', '%s héten belül'],
13
+ ['1 hónapja', '1 hónapon belül'],
14
+ ['%s hónapja', '%s hónapon belül'],
15
+ ['1 éve', '1 éven belül'],
16
+ ['%s éve', '%s éven belül']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('in_BG', function(number, index) {
2
+ return [
3
+ [ 'এইমাত্র' , 'একটা সময়'] ,
4
+ [ '%s সেকেন্ড আগে', '%s এর সেকেন্ডের মধ্যে'] ,
5
+ [ '1 মিনিট আগে', '1 মিনিটে'] ,
6
+ [ '%s এর মিনিট আগে', '%s এর মিনিটের মধ্যে'] ,
7
+ [ '1 ঘন্টা আগে', '1 ঘন্টা'] ,
8
+ [ '%s ঘণ্টা আগে', '%s এর ঘন্টার মধ্যে'] ,
9
+ [ '1 দিন আগে', '1 দিনের মধ্যে'] ,
10
+ [ '%s এর দিন আগে', '%s এর দিন'] ,
11
+ [ '1 সপ্তাহ আগে', '1 সপ্তাহের মধ্যে'] ,
12
+ [ '%s এর সপ্তাহ আগে', '%s সপ্তাহের মধ্যে'] ,
13
+ [ '1 মাস আগে', '1 মাসে'] ,
14
+ [ '%s মাস আগে', '%s মাসে'] ,
15
+ [ '1 বছর আগে', '1 বছরের মধ্যে'] ,
16
+ [ '%s বছর আগে', '%s বছরে']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('in_HI', function(number, index) {
2
+ return [
3
+ ['अभी', 'कुछ समय'],
4
+ ['%s सेकंड पहले', '%s सेकंड में'],
5
+ ['1 मिनट पहले', '1 मिनट में'],
6
+ ['%s मिनट पहले', '%s मिनट में'] ,
7
+ ['1 घंटे पहले', '1 घंटे में'] ,
8
+ ['%s घंटे पहले', '%s घंटे में'] ,
9
+ ['1 दिन पहले', '1 दिन में'] ,
10
+ ['%s दिन पहले', '%s दिनों में'] ,
11
+ ['1 सप्ताह पहले', '1 सप्ताह में'] ,
12
+ ['%s हफ्ते पहले', '%s हफ्तों में'] ,
13
+ ['1 महीने पहले', '1 महीने में'] ,
14
+ ['%s महीने पहले', '%s महीनों में'] ,
15
+ ['1 साल पहले', '1 साल में'] ,
16
+ ['%s साल पहले','%s साल में']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('in_ID', function(number, index) {
2
+ return [
3
+ ['baru saja', 'sebentar'],
4
+ ['%s detik yang lalu', 'dalam %s detik'],
5
+ ['1 menit yang lalu', 'dalam 1 menit'],
6
+ ['%s menit yang lalu', 'dalam %s menit'],
7
+ ['1 jam yang lalu', 'dalam 1 jam'],
8
+ ['%s jam yang lalu', 'dalam %s jam'],
9
+ ['1 hari yang lalu', 'dalam 1 hari'],
10
+ ['%s hari yang lalu', 'dalam %s hari'],
11
+ ['1 minggu yang lalu', 'dalam 1 minggu'],
12
+ ['%s minggu yang lalu', 'dalam %s minggu'],
13
+ ['1 bulan yang lalu', 'dalam 1 bulan'],
14
+ ['%s bulan yang lalu', 'dalam %s bulan'],
15
+ ['1 tahun yang lalu', 'dalam 1 tahun'],
16
+ ['%s tahun yang lalu', 'dalam %s tahun']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('it', function(number, index) {
2
+ return [
3
+ ['poco fa', 'tra poco'],
4
+ ['%s secondi fa', '%s secondi da ora'],
5
+ ['un minuto fa', 'un minuto da ora'],
6
+ ['%s minuti fa', '%s minuti da ora'],
7
+ ['un\'ora fa', 'un\'ora da ora'],
8
+ ['%s ore fa', '%s ore da ora'],
9
+ ['un giorno fa', 'un giorno da ora'],
10
+ ['%s giorni fa', '%s giorni da ora'],
11
+ ['una settimana fa', 'una settimana da ora'],
12
+ ['%s settimane fa', '%s settimane da ora'],
13
+ ['un mese fa', 'un mese da ora'],
14
+ ['%s mesi fa', '%s mesi da ora'],
15
+ ['un anno fa', 'un anno da ora'],
16
+ ['%s anni fa', '%s anni da ora']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('ja', function(number, index) {
2
+ return [
3
+ ['すこし前', 'すぐに'],
4
+ ['%s秒前', '%s秒以内'],
5
+ ['1分前', '1分以内'],
6
+ ['%s分前', '%s分以内'],
7
+ ['1時間前', '1時間以内'],
8
+ ['%s時間前', '%s時間以内'],
9
+ ['1日前', '1日以内'],
10
+ ['%s日前', '%s日以内'],
11
+ ['1週間前', '1週間以内'],
12
+ ['%s週間前', '%s週間以内'],
13
+ ['1ヶ月前', '1ヶ月以内'],
14
+ ['%sヶ月前', '%sヶ月以内'],
15
+ ['1年前', '1年以内'],
16
+ ['%s年前', '%s年以内']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('ko', function(number, index) {
2
+ return [
3
+ ['방금', '곧'],
4
+ ['%s초 전', '%s초 후'],
5
+ ['1분 전', '1분 후'],
6
+ ['%s분 전', '%s분 후'],
7
+ ['1시간 전', '1시간 후'],
8
+ ['%s시간 전', '%s시간 후'],
9
+ ['1일 전', '1일 후'],
10
+ ['%s일 전', '%s일 후'],
11
+ ['1주일 전', '1주일 후'],
12
+ ['%s주일 전', '%s주일 후'],
13
+ ['1개월 전', '1개월 후'],
14
+ ['%s개월 전', '%s개월 후'],
15
+ ['1년 전', '1년 후'],
16
+ ['%s년 전', '%s년 후']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('ml', function(number, index) {
2
+ return [
3
+ ['ഇപ്പോള്‍', 'കുറച്ചു മുന്‍പ്'],
4
+ ['%s സെക്കന്റ്‌കള്‍ക്ക് മുന്‍പ്', '%s സെക്കന്റില്‍'],
5
+ ['1 മിനിറ്റിനു മുന്‍പ്', '1 മിനിറ്റില്‍'],
6
+ ['%s മിനിറ്റുകള്‍ക്ക് മുന്‍പ', '%s മിനിറ്റില്‍'],
7
+ ['1 മണിക്കൂറിനു മുന്‍പ്', '1 മണിക്കൂറില്‍'],
8
+ ['%s മണിക്കൂറുകള്‍ക്കു മുന്‍പ്', '%s മണിക്കൂറില്‍'],
9
+ ['1 ഒരു ദിവസം മുന്‍പ്', '1 ദിവസത്തില്‍'],
10
+ ['%s ദിവസങ്ങള്‍ക് മുന്‍പ്', '%s ദിവസങ്ങള്‍ക്കുള്ളില്‍'],
11
+ ['1 ആഴ്ച മുന്‍പ്', '1 ആഴ്ചയില്‍'],
12
+ ['%s ആഴ്ചകള്‍ക്ക് മുന്‍പ്', '%s ആഴ്ചകള്‍ക്കുള്ളില്‍'],
13
+ ['1 മാസത്തിനു മുന്‍പ്', '1 മാസത്തിനുള്ളില്‍'],
14
+ ['%s മാസങ്ങള്‍ക്ക് മുന്‍പ്', '%s മാസങ്ങള്‍ക്കുള്ളില്‍'],
15
+ ['1 വര്‍ഷത്തിനു മുന്‍പ്', '1 വര്‍ഷത്തിനുള്ളില്‍'],
16
+ ['%s വര്‍ഷങ്ങള്‍ക്കു മുന്‍പ്', '%s വര്‍ഷങ്ങള്‍ക്കുല്ല്ളില്‍']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('nb_NO', function(number, index) {
2
+ return [
3
+ ['akkurat nå', 'om litt'],
4
+ ['%s sekunder siden', 'om %s sekunder'],
5
+ ['1 minutt siden', 'om 1 minutt'],
6
+ ['%s minutter siden', 'om %s minutter'],
7
+ ['1 time siden', 'om 1 time'],
8
+ ['%s timer siden', 'om %s timer'],
9
+ ['1 dag siden', 'om 1 dag'],
10
+ ['%s dager siden', 'om %s dager'],
11
+ ['1 uke siden', 'om 1 uke'],
12
+ ['%s uker siden', 'om %s uker'],
13
+ ['1 måned siden', 'om 1 måned'],
14
+ ['%s måneder siden', 'om %s måneder'],
15
+ ['1 år siden', 'om 1 år'],
16
+ ['%s år siden', 'om %s år']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('nl', function(number, index) {
2
+ return [
3
+ ['recent', 'binnenkort'],
4
+ ['%s seconden geleden', 'binnen %s seconden'],
5
+ ['1 minuut geleden', 'binnen 1 minuut'],
6
+ ['%s minuten geleden', 'binnen %s minuten'],
7
+ ['1 uur geleden', 'binnen 1 uur'],
8
+ ['%s uren geleden', 'binnen %s uren'],
9
+ ['1 dag geleden', 'binnen 1 dag'],
10
+ ['%s dagen geleden', 'binnen %s dagen'],
11
+ ['1 week geleden', 'binnen 1 week'],
12
+ ['%s weken geleden', 'binnen %s weken'],
13
+ ['1 maand geleden', 'binnen 1 maand'],
14
+ ['%s maanden geleden', 'binnen %s maanden'],
15
+ ['1 jaar geleden', 'binnen 1 jaar'],
16
+ ['%s jaren geleden', 'binnen %s jaren']
17
+ ][index];
18
+ })
@@ -0,0 +1,18 @@
1
+ this.timeago.register('nn_NO', function(number, index) {
2
+ return [
3
+ ['nett no', 'om litt'],
4
+ ['%s sekund sidan', 'om %s sekund'],
5
+ ['1 minutt sidan', 'om 1 minutt'],
6
+ ['%s minutt sidan', 'om %s minutt'],
7
+ ['1 time sidan', 'om 1 time'],
8
+ ['%s timar sidan', 'om %s timar'],
9
+ ['1 dag sidan', 'om 1 dag'],
10
+ ['%s dagar sidan', 'om %s dagar'],
11
+ ['1 veke sidan', 'om 1 veke'],
12
+ ['%s veker sidan', 'om %s veker'],
13
+ ['1 månad sidan', 'om 1 månad'],
14
+ ['%s månadar sidan', 'om %s månadar'],
15
+ ['1 år sidan', 'om 1 år'],
16
+ ['%s år sidan', 'om %s år']
17
+ ][index];
18
+ })
@@ -0,0 +1,38 @@
1
+ (function() {
2
+ // 0-13 alternately: single unit of time,
3
+ // genitive plural form for all other numbers excluding cases below:
4
+ // 14-20: nominative plural form for the numbers 2,3,4
5
+ // and all other numbers higher than 21 which end in 2,3,4
6
+ var l = [
7
+ ['w tej chwili', 'za chwilę'],
8
+ ['%s sekund temu', 'za %s sekund'],
9
+ ['1 minutę temu', 'za 1 minutę'],
10
+ ['%s minut temu', 'za %s minut'],
11
+ ['1 godzinę temu', 'za 1 godzinę'],
12
+ ['%s godzin temu', 'za %s godzin'],
13
+ ['1 dzień temu', 'za 1 dzień'], // ['wczoraj', 'jutro'],
14
+ ['%s dni temu', 'za %s dni'],
15
+ ['1 tydzień temu', 'za 1 tydzień'],
16
+ ['%s tygodni temu', 'za %s tygodni'],
17
+ ['1 miesiąc temu', 'za 1 miesiąc'],
18
+ ['%s miesięcy temu', 'za %s miesięcy'],
19
+ ['1 rok temu', 'za 1 rok'],
20
+ ['%s lat temu', 'za %s lat'],
21
+ ['%s sekundy temu', 'za %s sekundy'],
22
+ ['%s minuty temu', 'za %s minuty'],
23
+ ['%s godziny temu', 'za %s godziny'],
24
+ ['%s dni temu', 'za %s dni'],
25
+ ['%s tygodnie temu', 'za %s tygodnie'],
26
+ ['%s miesiące temu', 'za %s miesiące'],
27
+ ['%s lata temu', 'za %s lata']
28
+ ];
29
+
30
+ var _fn = function(number, index) {
31
+ // to determine which plural form must be used check the last 2 digits
32
+ // and calculate new index value to get the nominative form (14-20)
33
+ // for all other cases use index value as it is (0-13)
34
+ return l[index&1?(number%10>4||number%10<2||1===~~(number/10)%10?index:++index/2+13):index];
35
+ };
36
+
37
+ this.timeago.register('pl', _fn)
38
+ })();
@@ -0,0 +1,18 @@
1
+ this.timeago.register('pt_BR', function(number, index) {
2
+ return [
3
+ ['agora mesmo', 'daqui um pouco'],
4
+ ['há %s segundos', 'em %s segundos'],
5
+ ['há um minuto', 'em um minuto'],
6
+ ['há %s minutos', 'em %s minutos'],
7
+ ['há uma hora', 'em uma hora'],
8
+ ['há %s horas', 'em %s horas'],
9
+ ['há um dia', 'em um dia'],
10
+ ['há %s dias', 'em %s dias'],
11
+ ['há uma semana', 'em uma semana'],
12
+ ['há %s semanas', 'em %s semanas'],
13
+ ['há um mês', 'em um mês'],
14
+ ['há %s meses', 'em %s meses'],
15
+ ['há um ano', 'em um ano'],
16
+ ['há %s anos', 'em %s anos']
17
+ ][index];
18
+ })
@@ -0,0 +1,29 @@
1
+ this.timeago.register('ro', function(number, index) {
2
+ var langTable = [
3
+ ['chiar acum', 'chiar acum'],
4
+ ['acum %s secunde', 'peste %s secunde'],
5
+ ['acum un minut', 'peste un minut'],
6
+ ['acum %s minute', 'peste %s minute'],
7
+ ['acum o oră', 'peste o oră'],
8
+ ['acum %s ore', 'peste %s ore'],
9
+ ['acum o zi', 'peste o zi'],
10
+ ['acum %s zile', 'peste %s zile'],
11
+ ['acum o săptămână', 'peste o săptămână'],
12
+ ['acum %s săptămâni', 'peste %s săptămâni'],
13
+ ['acum o lună', 'peste o lună'],
14
+ ['acum %s luni', 'peste %s luni'],
15
+ ['acum un an', 'peste un an'],
16
+ ['acum %s ani', 'peste %s ani']
17
+ ];
18
+
19
+ if (number < 20) {
20
+ return langTable[index];
21
+ }
22
+
23
+ // A `de` preposition must be added between the number and the adverb
24
+ // if the number is greater than 20.
25
+ return [
26
+ langTable[index][0].replace('%s', '%s de'),
27
+ langTable[index][1].replace('%s', '%s de'),
28
+ ];
29
+ })
@@ -0,0 +1,55 @@
1
+ (function() {
2
+ var seconds = formatNum.bind(null, 'секунду', '%s секунду', '%s секунды', '%s секунд'),
3
+ minutes = formatNum.bind(null, 'минуту', '%s минуту', '%s минуты', '%s минут'),
4
+ hours = formatNum.bind(null, 'час', '%s час', '%s часа', '%s часов'),
5
+ days = formatNum.bind(null, 'день', '%s день', '%s дня', '%s дней'),
6
+ weeks = formatNum.bind(null, 'неделю', '%s неделю', '%s недели', '%s недель'),
7
+ months = formatNum.bind(null, 'месяц', '%s месяц', '%s месяца', '%s месяцев'),
8
+ years = formatNum.bind(null, 'год', '%s год', '%s года', '%s лет');
9
+
10
+ var _fn = function(number, index) {
11
+ switch(index) {
12
+ case 0: return ['только что', 'через несколько секунд'];
13
+ case 1: return [seconds(number) + ' назад', 'через ' + seconds(number)];
14
+ case 2: // ['минуту назад', 'через минуту'];
15
+ case 3: return [minutes(number) + ' назад', 'через ' + minutes(number)];
16
+ case 4: // ['час назад', 'через час'];
17
+ case 5: return [hours(number) + ' назад', 'через ' + hours(number)];
18
+ case 6: return ['вчера', 'завтра'];
19
+ case 7: return [days(number) + ' назад', 'через ' + days(number)];
20
+ case 8: // ['неделю назад', 'через неделю'];
21
+ case 9: return [weeks(number) + ' назад', 'через ' + weeks(number)];
22
+ case 10: // ['месяц назад', 'через месяц'];
23
+ case 11: return [months(number) + ' назад', 'через ' + months(number)];
24
+ case 12: // ['год назад', 'через год'];
25
+ case 13: return [years(number) + ' назад', 'через ' + years(number)];
26
+ default: return ['', '']
27
+ }
28
+ };
29
+
30
+ /**
31
+ *
32
+ * @param f1 - 1
33
+ * @param f - 21, 31, ...
34
+ * @param s - 2-4, 22-24, 32-34 ...
35
+ * @param t - 5-20, 25-30, ...
36
+ * @param n
37
+ * @returns {string}
38
+ */
39
+ function formatNum(f1, f, s, t, n) {
40
+ var n10 = n % 10,
41
+ str = t;
42
+
43
+ if (n === 1) {
44
+ str = f1;
45
+ } else if (n10 === 1 && n > 20) {
46
+ str = f;
47
+ } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) {
48
+ str = s;
49
+ }
50
+
51
+ return str;
52
+ }
53
+
54
+ this.timeago.register('ru', _fn)
55
+ })();