The right shows hours ago days ago and so on only English, can not be translated into other languages

The right shows hours ago days ago and so on only English, can not be translated into other languages.

1

my debug finding is that the following code (the returned text not translated is the root cause)

function prettyDate(time, mini) {
	if (!time) {
		time = new Date();
	}
	if ('moment' in window) { // use frappe.ImportError ;)
		let ret;
		if (frappe.sys_defaults && frappe.sys_defaults.time_zone) {
			ret = moment.tz(time, frappe.sys_defaults.time_zone).locale(frappe.boot.lang).fromNow(mini);
		} else {
			ret = moment(time).locale(frappe.boot.lang).fromNow(mini);
		}
		if (mini) {
			if (ret === moment().locale(frappe.boot.lang).fromNow(mini)) {
				ret = __("now");
			} else {
				var parts = ret.split(" ");
				if (parts.length > 1) {
					if (parts[0] === "a" || parts[0] === "an") {
						parts[0] = 1;
					}
					if (parts[1].substr(0, 2) === "mo") {
						ret = parts[0] + " M";
					} else {
						ret = parts[0] + " " + parts[1].substr(0, 1);
					}
				}
			}
			ret = ret.substr(0, 5);
		}
		return ret;

the solution is to call the __() for the untranslated text before the return of result(ret), but here need to handle the text split and join. code as below

	let num;
        let num_index;
	ret = ret.split(' ');
	num_index = 0;
	if (isNaN(ret[0]) && ! isNaN(ret[1])) num_index =1;
	num = ret[num_index];
	ret[num_index] = "{0}";
	ret = __(ret.join(' '),[num]);

	return ret;