From: Iskren Chernev Date: Wed, 1 Oct 2014 08:19:31 +0000 (-0700) Subject: Add ordinalParse to all locales (including en in core) X-Git-Tag: 2.8.4~31^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b685e46dd7565b942cef5769c782b905887d9f6;p=thirdparty%2Fmoment.git Add ordinalParse to all locales (including en in core) --- diff --git a/locale/af.js b/locale/af.js index 1b8c52078..c9c9131ef 100644 --- a/locale/af.js +++ b/locale/af.js @@ -54,6 +54,7 @@ y : '\'n jaar', yy : '%d jaar' }, + ordinalParse: /\d{1,2}(ste|de)/, ordinal : function (number) { return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter }, diff --git a/locale/az.js b/locale/az.js index e82f6e111..f7b051a2c 100644 --- a/locale/az.js +++ b/locale/az.js @@ -83,6 +83,7 @@ return 'axşam'; } }, + ordinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/, ordinal : function (number) { if (number === 0) { // special case for zero return number + '-ıncı'; diff --git a/locale/be.js b/locale/be.js index fe3186a19..5c5887165 100644 --- a/locale/be.js +++ b/locale/be.js @@ -127,6 +127,7 @@ } }, + ordinalParse: /\d{1,2}-(і|ы|га)/, ordinal: function (number, period) { switch (period) { case 'M': diff --git a/locale/bg.js b/locale/bg.js index 41b1e3aff..39621e4c2 100644 --- a/locale/bg.js +++ b/locale/bg.js @@ -59,6 +59,7 @@ y : 'година', yy : '%d години' }, + ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, ordinal : function (number) { var lastDigit = number % 10, last2Digits = number % 100; diff --git a/locale/br.js b/locale/br.js index a4f1491d5..611c54d9f 100644 --- a/locale/br.js +++ b/locale/br.js @@ -95,6 +95,7 @@ y : 'ur bloaz', yy : specialMutationForYears }, + ordinalParse: /\d{1,2}(añ|vet)/, ordinal : function (number) { var output = (number === 1) ? 'añ' : 'vet'; return number + output; diff --git a/locale/bs.js b/locale/bs.js index b9a585165..810ae0329 100644 --- a/locale/bs.js +++ b/locale/bs.js @@ -129,6 +129,7 @@ y : 'godinu', yy : translate }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/ca.js b/locale/ca.js index fd41ff54d..6290ca2ac 100644 --- a/locale/ca.js +++ b/locale/ca.js @@ -57,6 +57,7 @@ y : 'un any', yy : '%d anys' }, + ordinalParse : /\d{1,2}º/, ordinal : '%dº', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/cs.js b/locale/cs.js index 87dec552e..d49241f92 100644 --- a/locale/cs.js +++ b/locale/cs.js @@ -146,6 +146,7 @@ y : translate, yy : translate }, + ordinalParse : /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/cv.js b/locale/cv.js index 138b6c158..8c702d228 100644 --- a/locale/cv.js +++ b/locale/cv.js @@ -50,6 +50,7 @@ y : 'пĕр çул', yy : '%d çул' }, + ordinalParse: /\d{1,2}-мĕш/, ordinal : '%d-мĕш', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/cy.js b/locale/cy.js index 65fb356b9..16ffbf16f 100644 --- a/locale/cy.js +++ b/locale/cy.js @@ -48,6 +48,7 @@ y: 'blwyddyn', yy: '%d flynedd' }, + ordinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh ordinal: function (number) { var b = number, diff --git a/locale/da.js b/locale/da.js index 5e9ef96d9..eb2153a0b 100644 --- a/locale/da.js +++ b/locale/da.js @@ -47,6 +47,7 @@ y : 'et år', yy : '%d år' }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/de-at.js b/locale/de-at.js index ff715f893..628f1e99e 100644 --- a/locale/de-at.js +++ b/locale/de-at.js @@ -63,6 +63,7 @@ y : processRelativeTime, yy : processRelativeTime }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/de.js b/locale/de.js index 11ab9ace2..7cee99957 100644 --- a/locale/de.js +++ b/locale/de.js @@ -62,6 +62,7 @@ y : processRelativeTime, yy : processRelativeTime }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/el.js b/locale/el.js index eb8eb1a97..f81051dfc 100644 --- a/locale/el.js +++ b/locale/el.js @@ -83,9 +83,8 @@ y : 'ένας χρόνος', yy : '%d χρόνια' }, - ordinal : function (number) { - return number + 'η'; - }, + ordinalParse: /\d{1,2}η/, + ordinal: '%dη', week : { dow : 1, // Monday is the first day of the week. doy : 4 // The week that contains Jan 4st is the first week of the year. diff --git a/locale/en-au.js b/locale/en-au.js index 75ad34a10..f0e05b722 100644 --- a/locale/en-au.js +++ b/locale/en-au.js @@ -46,6 +46,7 @@ y : 'a year', yy : '%d years' }, + ordinalParse: /\d{1,2}(st|nd|rd|th)/, ordinal : function (number) { var b = number % 10, output = (~~(number % 100 / 10) === 1) ? 'th' : diff --git a/locale/en-ca.js b/locale/en-ca.js index 077dc8b57..b91ad0c1c 100644 --- a/locale/en-ca.js +++ b/locale/en-ca.js @@ -47,6 +47,7 @@ y : 'a year', yy : '%d years' }, + ordinalParse: /\d{1,2}(st|nd|rd|th)/, ordinal : function (number) { var b = number % 10, output = (~~(number % 100 / 10) === 1) ? 'th' : diff --git a/locale/en-gb.js b/locale/en-gb.js index 4491d4a1e..9bfd6926c 100644 --- a/locale/en-gb.js +++ b/locale/en-gb.js @@ -47,6 +47,7 @@ y : 'a year', yy : '%d years' }, + ordinalParse: /\d{1,2}(st|nd|rd|th)/, ordinal : function (number) { var b = number % 10, output = (~~(number % 100 / 10) === 1) ? 'th' : diff --git a/locale/eo.js b/locale/eo.js index 735ed8eaa..37b648036 100644 --- a/locale/eo.js +++ b/locale/eo.js @@ -56,6 +56,7 @@ y : 'jaro', yy : '%d jaroj' }, + ordinalParse: /\d{1,2}a/, ordinal : '%da', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/es.js b/locale/es.js index 04b83a80c..ae79e4424 100644 --- a/locale/es.js +++ b/locale/es.js @@ -66,6 +66,7 @@ y : 'un año', yy : '%d años' }, + ordinalParse : /\d{1,2}º/, ordinal : '%dº', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/et.js b/locale/et.js index 242ee169c..b76155c61 100644 --- a/locale/et.js +++ b/locale/et.js @@ -67,6 +67,7 @@ y : processRelativeTime, yy : processRelativeTime }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/eu.js b/locale/eu.js index 8fb89b49f..c80fe2109 100644 --- a/locale/eu.js +++ b/locale/eu.js @@ -51,6 +51,7 @@ y : 'urte bat', yy : '%d urte' }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/fa.js b/locale/fa.js index b1151bdd3..508fea972 100644 --- a/locale/fa.js +++ b/locale/fa.js @@ -88,6 +88,7 @@ return symbolMap[match]; }).replace(/,/g, '،'); }, + ordinalParse: /\d{1,2}م/, ordinal : '%dم', week : { dow : 6, // Saturday is the first day of the week. diff --git a/locale/fi.js b/locale/fi.js index 1fedcabac..b3fbce92c 100644 --- a/locale/fi.js +++ b/locale/fi.js @@ -96,6 +96,7 @@ y : translate, yy : translate }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/fo.js b/locale/fo.js index a27f9da65..30a4f16ab 100644 --- a/locale/fo.js +++ b/locale/fo.js @@ -47,6 +47,7 @@ y : 'eitt ár', yy : '%d ár' }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/fr-ca.js b/locale/fr-ca.js index c0f1bdc66..80ac5d281 100644 --- a/locale/fr-ca.js +++ b/locale/fr-ca.js @@ -47,6 +47,7 @@ y : 'un an', yy : '%d ans' }, + ordinalParse: /\d{1,2}(er|)/, ordinal : function (number) { return number + (number === 1 ? 'er' : ''); } diff --git a/locale/fr.js b/locale/fr.js index f217ff1d4..cba431e66 100644 --- a/locale/fr.js +++ b/locale/fr.js @@ -47,6 +47,7 @@ y : 'un an', yy : '%d ans' }, + ordinalParse: /\d{1,2}(er|)/, ordinal : function (number) { return number + (number === 1 ? 'er' : ''); }, diff --git a/locale/gl.js b/locale/gl.js index ac638629e..f1d615901 100644 --- a/locale/gl.js +++ b/locale/gl.js @@ -62,6 +62,7 @@ y : 'un ano', yy : '%d anos' }, + ordinalParse : /\d{1,2}º/, ordinal : '%dº', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/hr.js b/locale/hr.js index 9e3f6fa30..30098a17a 100644 --- a/locale/hr.js +++ b/locale/hr.js @@ -130,6 +130,7 @@ y : 'godinu', yy : translate }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/hu.js b/locale/hu.js index 73fdb83fb..eae97bb9d 100644 --- a/locale/hu.js +++ b/locale/hu.js @@ -96,6 +96,7 @@ y : translate, yy : translate }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/hy-am.js b/locale/hy-am.js index affcd7e87..9b6d3f332 100644 --- a/locale/hy-am.js +++ b/locale/hy-am.js @@ -89,6 +89,7 @@ } }, + ordinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, ordinal: function (number, period) { switch (period) { case 'DDD': diff --git a/locale/is.js b/locale/is.js index 479f82d9c..6ee6a314c 100644 --- a/locale/is.js +++ b/locale/is.js @@ -115,6 +115,7 @@ y : translate, yy : translate }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/it.js b/locale/it.js index 669539090..2ab07bdeb 100644 --- a/locale/it.js +++ b/locale/it.js @@ -50,6 +50,7 @@ y : 'un anno', yy : '%d anni' }, + ordinalParse : /\d{1,2}º/, ordinal: '%dº', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/ka.js b/locale/ka.js index 73eb9c75a..53f7045cc 100644 --- a/locale/ka.js +++ b/locale/ka.js @@ -84,6 +84,7 @@ y : 'წელი', yy : '%d წელი' }, + ordinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, ordinal : function (number) { if (number === 0) { return number; diff --git a/locale/ko.js b/locale/ko.js index 57017f5ea..6645b5ef9 100644 --- a/locale/ko.js +++ b/locale/ko.js @@ -54,6 +54,7 @@ y : '일년', yy : '%d년' }, + ordinalParse : /\d{1,2}일/, ordinal : '%d일', meridiemParse : /(오전|오후)/, isPM : function (token) { diff --git a/locale/lb.js b/locale/lb.js index 14fab973b..cb5877783 100644 --- a/locale/lb.js +++ b/locale/lb.js @@ -128,6 +128,7 @@ y : processRelativeTime, yy : '%d Joer' }, + ordinalParse: /\d{1,2}\./, ordinal: '%d.', week: { dow: 1, // Monday is the first day of the week. diff --git a/locale/lt.js b/locale/lt.js index 013f8f1e3..0b5ec0029 100644 --- a/locale/lt.js +++ b/locale/lt.js @@ -107,6 +107,7 @@ y : translateSingular, yy : translate }, + ordinalParse: /\d{1,2}-oji/, ordinal : function (number) { return number + '-oji'; }, diff --git a/locale/lv.js b/locale/lv.js index 7e1892e38..aa336d9e2 100644 --- a/locale/lv.js +++ b/locale/lv.js @@ -68,6 +68,7 @@ y : 'gadu', yy : relativeTimeWithPlural }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/mk.js b/locale/mk.js index 94c7fc1a2..3106f9990 100644 --- a/locale/mk.js +++ b/locale/mk.js @@ -59,6 +59,7 @@ y : 'година', yy : '%d години' }, + ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, ordinal : function (number) { var lastDigit = number % 10, last2Digits = number % 100; diff --git a/locale/nb.js b/locale/nb.js index 533659d58..81627f956 100644 --- a/locale/nb.js +++ b/locale/nb.js @@ -48,6 +48,7 @@ y : 'ett år', yy : '%d år' }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/nl.js b/locale/nl.js index 213beeb88..15da00966 100644 --- a/locale/nl.js +++ b/locale/nl.js @@ -56,6 +56,7 @@ y : 'één jaar', yy : '%d jaar' }, + ordinalParse: /\d{1,2}(ste|de)/, ordinal : function (number) { return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); }, diff --git a/locale/nn.js b/locale/nn.js index c5b65055b..665bcce7a 100644 --- a/locale/nn.js +++ b/locale/nn.js @@ -47,6 +47,7 @@ y : 'eit år', yy : '%d år' }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/pl.js b/locale/pl.js index 63a62f135..b3d48debf 100644 --- a/locale/pl.js +++ b/locale/pl.js @@ -89,6 +89,7 @@ y : 'rok', yy : translate }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/pt-br.js b/locale/pt-br.js index 44eedaf08..78af5e747 100644 --- a/locale/pt-br.js +++ b/locale/pt-br.js @@ -51,6 +51,7 @@ y : 'um ano', yy : '%d anos' }, + ordinalParse: /\d{1,2}º/, ordinal : '%dº' }); })); diff --git a/locale/pt.js b/locale/pt.js index aced692e5..4b170683a 100644 --- a/locale/pt.js +++ b/locale/pt.js @@ -51,6 +51,7 @@ y : 'um ano', yy : '%d anos' }, + ordinalParse: /\d{1,2}º/, ordinal : '%dº', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/ru.js b/locale/ru.js index 2f15233b5..dcdac8eea 100644 --- a/locale/ru.js +++ b/locale/ru.js @@ -142,6 +142,7 @@ } }, + ordinalParse: /\d{1,2}-(й|го|я)/, ordinal: function (number, period) { switch (period) { case 'M': diff --git a/locale/sk.js b/locale/sk.js index 991afebb3..4b8a5d274 100644 --- a/locale/sk.js +++ b/locale/sk.js @@ -147,6 +147,7 @@ y : translate, yy : translate }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/sl.js b/locale/sl.js index 2bdbf1cdf..0f8507e63 100644 --- a/locale/sl.js +++ b/locale/sl.js @@ -135,6 +135,7 @@ y : 'eno leto', yy : translate }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/sq.js b/locale/sq.js index 6ae417877..633708200 100644 --- a/locale/sq.js +++ b/locale/sq.js @@ -52,6 +52,7 @@ y : 'një vit', yy : '%d vite' }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/sr-cyrl.js b/locale/sr-cyrl.js index 7278de6e4..2e4f9d84f 100644 --- a/locale/sr-cyrl.js +++ b/locale/sr-cyrl.js @@ -96,6 +96,7 @@ y : 'годину', yy : translator.translate }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/sr.js b/locale/sr.js index d008282ee..62399d2c8 100644 --- a/locale/sr.js +++ b/locale/sr.js @@ -96,6 +96,7 @@ y : 'godinu', yy : translator.translate }, + ordinalParse: /\d{1,2}\./, ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. diff --git a/locale/sv.js b/locale/sv.js index 634b3cfec..812431e65 100644 --- a/locale/sv.js +++ b/locale/sv.js @@ -47,6 +47,7 @@ y : 'ett år', yy : '%d år' }, + ordinalParse: /\d{1,2}(e|a)/, ordinal : function (number) { var b = number % 10, output = (~~(number % 100 / 10) === 1) ? 'e' : diff --git a/locale/ta.js b/locale/ta.js index 53bab0d9c..ee5a8c8be 100644 --- a/locale/ta.js +++ b/locale/ta.js @@ -82,6 +82,7 @@ return symbolMap[match]; }); },*/ + ordinalParse: /\d{1,2}வது/, ordinal : function (number) { return number + 'வது'; }, diff --git a/locale/tl-ph.js b/locale/tl-ph.js index c15cc1f08..4ad2b1cd1 100644 --- a/locale/tl-ph.js +++ b/locale/tl-ph.js @@ -47,6 +47,7 @@ y : 'isang taon', yy : '%d taon' }, + ordinalParse: /\d{1,2}/, ordinal : function (number) { return number; }, diff --git a/locale/tr.js b/locale/tr.js index 36e8fca17..269269b61 100644 --- a/locale/tr.js +++ b/locale/tr.js @@ -74,6 +74,7 @@ y : 'bir yıl', yy : '%d yıl' }, + ordinalParse: /\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/, ordinal : function (number) { if (number === 0) { // special case for zero return number + '\'ıncı'; diff --git a/locale/uk.js b/locale/uk.js index bc22fff93..6b02a2302 100644 --- a/locale/uk.js +++ b/locale/uk.js @@ -134,6 +134,7 @@ } }, + ordinalParse: /\d{1,2}-(й|го)/, ordinal: function (number, period) { switch (period) { case 'M': diff --git a/locale/vi.js b/locale/vi.js index 20e3ffe24..7c4175f44 100644 --- a/locale/vi.js +++ b/locale/vi.js @@ -51,6 +51,7 @@ y : 'một năm', yy : '%d năm' }, + ordinalParse: /\d{1,2}/, ordinal : function (number) { return number; }, diff --git a/locale/zh-cn.js b/locale/zh-cn.js index aff26c5e7..93eac9acb 100644 --- a/locale/zh-cn.js +++ b/locale/zh-cn.js @@ -69,6 +69,7 @@ }, sameElse : 'LL' }, + ordinalParse: /\d{1,2}(日|月|周)/, ordinal : function (number, period) { switch (period) { case 'd': diff --git a/locale/zh-tw.js b/locale/zh-tw.js index 71f99a269..cebc2111f 100644 --- a/locale/zh-tw.js +++ b/locale/zh-tw.js @@ -50,6 +50,7 @@ lastWeek : '[上]ddddLT', sameElse : 'L' }, + ordinalParse: /\d{1,2}(日|月|週)/, ordinal : function (number, period) { switch (period) { case 'd' : diff --git a/moment.js b/moment.js index 242590f8c..1cc739bd4 100644 --- a/moment.js +++ b/moment.js @@ -2808,6 +2808,7 @@ // Set default locale, other locale will inherit from English. moment.locale('en', { + ordinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal : function (number) { var b = number % 10, output = (toInt(number % 100 / 10) === 1) ? 'th' :