Skip to content

A platform for community discussion. Free, open, simple.

UX: More translations for admin dashboard (#30570)

Martin Brennand8692faf00d0
diff --git a/app/assets/javascripts/admin/addon/models/report.js b/app/assets/javascripts/admin/addon/models/report.js
index 868cc28e441..c77f6222b2b 100644
--- a/app/assets/javascripts/admin/addon/models/report.js
+++ b/app/assets/javascripts/admin/addon/models/report.js
@@ -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"
);
}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 488435ed6e3..1c5f9520b5e 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -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"