From: Tal Ater Date: Wed, 14 Aug 2013 22:47:34 +0000 (+0300) Subject: Added Hebrew dual form for hours, days, months and years X-Git-Tag: 2.2.0~19^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=353d44589ce85ff11edfe247a56ea9a7f4f02b7f;p=thirdparty%2Fmoment.git Added Hebrew dual form for hours, days, months and years --- diff --git a/lang/he.js b/lang/he.js index 5495f4095..9b357acfb 100644 --- a/lang/he.js +++ b/lang/he.js @@ -35,12 +35,32 @@ require('../moment').lang('he', { m : "דקה", mm : "%d דקות", h : "שעה", - hh : "%d שעות", + hh : function (number) { + if (number === 2) { + return "שעתיים"; + } + return number+" שעות"; + }, d : "יום", - dd : "%d ימים", + dd : function (number) { + if (number === 2) { + return "יומיים"; + } + return number+" ימים"; + }, M : "חודש", - MM : "%d חודשים", + MM : function (number) { + if (number === 2) { + return "חודשיים"; + } + return number+" חודשים"; + }, y : "שנה", - yy : "%d שנים" + yy : function (number) { + if (number === 2) { + return "שנתיים"; + } + return number+" שנים"; + } } }); diff --git a/test/lang/he.js b/test/lang/he.js index b35a10ba7..140d85628 100644 --- a/test/lang/he.js +++ b/test/lang/he.js @@ -100,27 +100,27 @@ exports["lang:he"] = { test.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), "44 דקות", "44 minutes = 44 minutes"); test.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), "שעה", "45 minutes = an hour"); test.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), "שעה", "89 minutes = an hour"); - test.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), "2 שעות", "90 minutes = 2 hours"); + test.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), "שעתיים", "90 minutes = 2 hours"); test.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), "5 שעות", "5 hours = 5 hours"); test.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), "21 שעות", "21 hours = 21 hours"); test.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), "יום", "22 hours = a day"); test.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), "יום", "35 hours = a day"); - test.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), "2 ימים", "36 hours = 2 days"); + test.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), "יומיים", "36 hours = 2 days"); test.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), "יום", "1 day = a day"); test.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), "5 ימים", "5 days = 5 days"); test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 ימים", "25 days = 25 days"); test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "חודש", "26 days = a month"); test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "חודש", "30 days = a month"); test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "חודש", "45 days = a month"); - test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 חודשים", "46 days = 2 months"); - test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 חודשים", "75 days = 2 months"); + test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "חודשיים", "46 days = 2 months"); + test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "חודשיים", "75 days = 2 months"); test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 חודשים", "76 days = 3 months"); test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "חודש", "1 month = a month"); test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 חודשים", "5 months = 5 months"); test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 חודשים", "344 days = 11 months"); test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "שנה", "345 days = a year"); test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "שנה", "547 days = a year"); - test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 שנים", "548 days = 2 years"); + test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "שנתיים", "548 days = 2 years"); test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "שנה", "1 year = a year"); test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 שנים", "5 years = 5 years"); test.done();