Added basic localization for timestamps

This commit implements basic localization for the timestamps in conversations and the conversation list.

// FREEBIE
This commit is contained in:
Benedikt Radtke 2016-06-26 20:36:36 +02:00 committed by lilia
parent e07616e2ef
commit e836bfd3f7
2 changed files with 74 additions and 33 deletions

View file

@ -308,5 +308,69 @@
"syncFailed": {
"message": "Import failed. Make sure your computer and your phone are connected to the internet.",
"description": "Informational text displayed if a sync operation times out."
},
"timestamp_s": {
"description": "",
"message": "now"
},
"timestamp_m": {
"description": "",
"message": "1 min"
},
"timestamp_mm": {
"description": "",
"message": "%d min"
},
"timestamp_h": {
"description": "",
"message": "1 hour"
},
"timestamp_hh": {
"description": "",
"message": "%d hours"
},
"timestampFormat_y" : {
"description": "",
"message": "MMM D, YYYY"
},
"timestampFormat_m" : {
"description": "",
"message": "MMM D"
},
"timestampFormat_d" : {
"description": "",
"message": "ddd"
},
"extendedTimestamp_s": {
"description": "",
"message": "now"
},
"extendedTimestamp_m": {
"description": "",
"message": "1 minute ago"
},
"extendedTimestamp_mm": {
"description": "",
"message": "%d minute ago"
},
"extendedTimestamp_h": {
"description": "",
"message": "1 hour ago"
},
"extendedTimestamp_hh": {
"description": "",
"message": "%d hours ago"
},
"extendedTimestampFormat_y" : {
"description": "",
"message": "MMM D, YYYY LT"
},
"extendedTimestampFormat_m" : {
"description": "",
"message": "MMM D LT"
},
"extendedTimestampFormat_d" : {
"description": "",
"message": "ddd LT"
}
}

View file

@ -66,45 +66,22 @@
}
},
relativeTime : function (number, string, isFuture) {
return this._relativeTime[string].replace(/%d/i, number);
},
_relativeTime : {
s: "now",
m: "1 min",
mm: "%d min",
h: "1 hour",
hh: "%d hours",
d: "1 day",
dd: "%d days",
M: "1 month",
MM: "%d months",
y: "1 year",
yy: "%d years"
return i18n("timestamp_"+string).replace(/%d/i, number);
},
_format: {
y: 'MMM D, YYYY',
m: 'MMM D',
d: 'ddd'
y: i18n('timestampFormat_y'),
m: i18n('timestampFormat_m'),
d: i18n('timestampFormat_d')
}
});
Whisper.ExtendedTimestampView = Whisper.TimestampView.extend({
_relativeTime : {
s: "now",
m: "1 minute ago",
mm: "%d minutes ago",
h: "1 hour ago",
hh: "%d hours ago",
d: "1 day ago",
dd: "%d days ago",
M: "1 month ago",
MM: "%d months ago",
y: "1 year ago",
yy: "%d years ago"
relativeTime : function (number, string, isFuture) {
return i18n("extendedTimestamp_"+string).replace(/%d/i, number);
},
_format: {
y: 'MMM D, YYYY LT',
m: 'MMM D LT',
d: 'ddd LT'
y: i18n('extendedTimestampFormat_y'),
m: i18n('extendedTimestampFormat_m'),
d: i18n('extendedTimestampFormat_d')
}
});
})();