Permalink
Browse files

fix some bugs for zh-cn locale

  • Loading branch information...
skywalker skywalker
skywalker authored and skywalker committed Mar 3, 2012
1 parent 757dd3f commit 8aa42752c6738771a73c5a39f8b68b1acc9b2488
Showing with 40 additions and 40 deletions.
  1. +8 −8 lang/zh-cn.js
  2. +32 −32 test/lang/zh-cn.js
View
@@ -28,20 +28,20 @@
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 '';
}
};
View
@@ -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,58 +85,58 @@ 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();
},
"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();
}
-};
+};

0 comments on commit 8aa4275

Please sign in to comment.