Last active
November 12, 2015 05:18
Revisions
-
jorinvo revised this gist
Nov 12, 2015 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
jorinvo created this gist
Nov 12, 2015 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ module.exports = { emptyDoc: 'Write …', search: 'Search …', footer: 'write lite, open source', share: 'share', open: 'open', modified: 'modified', welcome: require('./welcome.txt'), secondsAgo: function (x) { if (x === 1) return 'a second ago'; return x + ' seconds ago'; }, minutesAgo: function (x) { if (x === 1) return 'a minute ago'; return x + ' minutes ago'; }, hoursAgo: function (x) { if (x === 1) return 'an hour ago'; return x + ' hours ago'; }, daysAgo: function (x) { if (x === 1) return 'a day ago'; return x + ' days ago'; }, monthsAgo: function (x) { if (x === 1) return 'a month ago'; return x + ' months ago'; }, yearsAgo: function (x) { if (x === 1) return 'a year ago'; return x + ' years ago'; } }; This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ function plural(word, num) { var forms = word.split('_'); return num === 1 ? forms[0] : forms[1]; } module.exports = { emptyDoc: 'Write …', search: 'Search …', footer: 'write lite, open source', share: 'share', open: 'open', modified: 'modified', welcome: require('./welcome.txt'), timeAgo: function relativeTimeWithPlural(number, key) { var format = { 'ss': 'second_seconds', 'mm': 'minute_minutes', 'hh': 'hour_hours', 'dd': 'day_days', 'MM': 'month_months', 'yy': 'year_years' }; if (number === 1) { return 'a ' + plural(format[key], +number) + ' ago'; } else { return number + ' ' + plural(format[key], +number) + ' ago'; } } };