UX: More translations for admin dashboard (#30570)

Followup 8d5c4ecc33

Implement review suggestions from https://github.com/discourse/discourse/pull/30541
after merge, and also fix other hardcoded strings on this
dashboard.
This commit is contained in:
Martin Brennan 2025-01-07 09:49:34 +10:00 committed by GitHub
parent 32e56e85e8
commit d8692faf00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 10 deletions

View File

@ -376,9 +376,9 @@ export default class Report extends EmberObject {
if (isNaN(change) || !isFinite(change)) {
return null;
} else if (change > 0) {
return "+" + change.toFixed(0) + "%";
return `+${i18n("js.number.percent", { count: change.toFixed(0) })}`;
} else {
return change.toFixed(0) + "%";
return `${i18n("js.number.percent", { count: change.toFixed(0) })}`;
}
}
@ -416,17 +416,20 @@ export default class Report extends EmberObject {
);
}
title.push(
i18n("admin.dashboard.reports.percent_change_tooltip_previous_value", {
previousValue: number(valAtT1),
previousPeriod: prevPeriodString,
})
i18n(
`admin.dashboard.reports.percent_change_tooltip_previous_value.${prevPeriodString}`,
{
count: valAtT1,
previousValue: number(valAtT1),
}
)
);
return title.join(" ");
}
@discourseComputed("yesterdayCount")
yesterdayCountTitle(yesterdayCount) {
return this.changeTitle(this.valueAt(2), yesterdayCount, "two days ago");
return this.changeTitle(this.valueAt(2), yesterdayCount, "yesterday");
}
@discourseComputed("lastSevenDaysCount")
@ -434,7 +437,7 @@ export default class Report extends EmberObject {
return this.changeTitle(
this.valueFor(8, 14),
lastSevenDaysCount,
"two weeks ago"
"two_weeks_ago"
);
}
@ -448,7 +451,7 @@ export default class Report extends EmberObject {
return this.changeTitle(
prev30Days ?? prev_period,
lastThirtyDaysCount,
"in the previous 30 day period"
"thirty_days_ago"
);
}

View File

@ -5236,7 +5236,16 @@ en:
reports:
trend_title: "%{percent} change. Currently %{current}, was %{prev} in previous period."
percent_change_tooltip: "%{percent} change."
percent_change_tooltip_previous_value: "Was %{previousValue} %{previousPeriod}."
percent_change_tooltip_previous_value:
yesterday:
one: "Was %{count} two days ago."
other: "Was %{count} two days ago."
two_weeks_ago:
one: "Was %{count} two weeks ago."
other: "Was %{count} two weeks ago."
thirty_days_ago:
one: "Was %{count} in the previous 30 day period."
other: "Was %{count} in the previous 30 day period."
today: "Today"
yesterday: "Yesterday"
last_7_days: "Last 7"