]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
fix some bugs for zh-cn locale 191/head
authorskywalker <skywalker@skywalker-VirtualBox.(none)>
Sat, 3 Mar 2012 05:36:50 +0000 (13:36 +0800)
committerskywalker <skywalker@skywalker-VirtualBox.(none)>
Sat, 3 Mar 2012 05:36:50 +0000 (13:36 +0800)
lang/zh-cn.js
test/lang/zh-cn.js

index b5360bfdeda29c883906a8f88dff350d892961a1..96c73554ee9e3cbc6b5cd0dfac3eee870f5edf25 100644 (file)
             relativeTime : {
                 future : "%s后",
                 past : "%s前",
-                s : "秒",
-                m : "分钟",
+                s : "秒",
+                m : "1分钟",
                 mm : "%d分钟",
-                h : "小时",
+                h : "1小时",
                 hh : "%d小时",
-                d : "天",
+                d : "1天",
                 dd : "%d天",
-                M : "个月",
-                MM : "%d月",
-                y : "年",
+                M : "1个月",
+                MM : "%d月",
+                y : "1年",
                 yy : "%d年"
             },
             ordinal : function (number) {
-                    return '.';
+                    return '';
             }
         };
 
index 4b1cdf6bf09767f3b2496c47bdcf78d4bfecad3f..fe1c0ffee8665b605778402a500c3d94177cca3f 100644 (file)
@@ -32,20 +32,20 @@ exports["lang:zh-cn"] = {
         test.expect(18);
         moment.lang('zh-cn');
         var a = [
-                ['dddd, MMMM Do YYYY, a h:mm:ss',      '星期日, 二月 14. 2010, 下午 3:25:50'],
+                ['dddd, MMMM Do YYYY, a h:mm:ss',      '星期日, 二月 14 2010, 下午 3:25:50'],
                 ['ddd, Ah',                            '周日, 下午3'],
-                ['M Mo MM MMMM MMM',                   '2 2. 02 二月 二月'],
+                ['M Mo MM MMMM MMM',                   '2 2 02 二月 二月'],
                 ['YYYY YY',                            '2010 10'],
-                ['D Do DD',                            '14 14. 14'],
-                ['d do dddd ddd',                      '0 0. 星期日 周日'],
-                ['DDD DDDo DDDD',                      '45 45. 045'],
-                ['w wo ww',                            '8 8. 08'],
+                ['D Do DD',                            '14 14 14'],
+                ['d do dddd ddd',                      '0 0 星期日 周日'],
+                ['DDD DDDo DDDD',                      '45 45 045'],
+                ['w wo ww',                            '8 8 08'],
                 ['h hh',                               '3 03'],
                 ['H HH',                               '15 15'],
                 ['m mm',                               '25 25'],
                 ['s ss',                               '50 50'],
                 ['a A',                                '下午 下午'],
-                ['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45. day of the year'],
+                ['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45 day of the year'],
                 ['L',                                  '14/02/2010'],
                 ['LL',                                 '14 二月 2010'],
                 ['LLL',                                '14 二月 2010 3:25 下午'],
@@ -85,35 +85,35 @@ exports["lang:zh-cn"] = {
         test.expect(30);
         moment.lang('zh-cn');
         var start = moment([2007, 1, 28]);
-        test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true),  "秒",   "44 seconds = a few seconds");
-        test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true),  "分钟", "45 seconds = a minute");
-        test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true),  "分钟", "89 seconds = a minute");
+        test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true),  "秒",   "44 seconds = a few seconds");
+        test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true),  "1分钟", "45 seconds = a minute");
+        test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true),  "1分钟", "89 seconds = a minute");
         test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true),  "2分钟",  "90 seconds = 2 minutes");
         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:45}), true),  "1小时", "45 minutes = an hour");
+        test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true),  "1小时", "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({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:22}), true),  "1天",   "22 hours = a day");
+        test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true),  "1天",   "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({d:1}), true),   "天",   "1 day = a day");
+        test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true),   "1天",   "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: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:26}), true),  "1个月", "26 days = a month");
+        test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true),  "1个月", "30 days = a month");
+        test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true),  "1个月", "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:76}), true),  "3月",  "76 days = 3 months");
+        test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true),   "1个月", "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), "1年",   "345 days = a year");
+        test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "1年",   "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({y:1}), true),   "年",   "1 year = a year");
+        test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true),   "1年",   "1 year = a year");
         test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true),   "5年",   "5 years = 5 years");
         test.done();
     },
@@ -121,22 +121,22 @@ exports["lang:zh-cn"] = {
     "suffix" : function(test) {
         test.expect(2);
         moment.lang('zh-cn');
-        test.equal(moment(30000).from(0), "秒后",  "prefix");
-        test.equal(moment(0).from(30000), "秒前", "suffix");
+        test.equal(moment(30000).from(0), "秒后",  "prefix");
+        test.equal(moment(0).from(30000), "秒前", "suffix");
         test.done();
     },
 
     "now from now" : function(test) {
         test.expect(1);
         moment.lang('zh-cn');
-        test.equal(moment().fromNow(), "秒前",  "now from now should display as in the past");
+        test.equal(moment().fromNow(), "秒前",  "now from now should display as in the past");
         test.done();
     },
 
     "fromNow" : function(test) {
         test.expect(2);
         moment.lang('zh-cn');
-        test.equal(moment().add({s:30}).fromNow(), "秒后", "in a few seconds");
+        test.equal(moment().add({s:30}).fromNow(), "秒后", "in a few seconds");
         test.equal(moment().add({d:5}).fromNow(), "5天后", "in 5 days");
         test.done();
     },
@@ -205,4 +205,4 @@ exports["lang:zh-cn"] = {
         test.equal(weeksFromNow.calendar(),   weeksFromNow.format('L'),  "in 2 weeks");
     test.done();
     }
-};
\ No newline at end of file
+};