Skip to content

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

FIX: Show username instead of "You/Your" when viewing another user's Rewind (#36937)

Régis Hanolffbf6cb8837e
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/activity-calendar.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/activity-calendar.gjs
index 6bb8c1b8b41..749895d1568 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/activity-calendar.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/activity-calendar.gjs
@@ -2,6 +2,7 @@ import Component from "@glimmer/component";
import { action } from "@ember/object";
import concatClass from "discourse/helpers/concat-class";
import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
const ROWS = 7;
const COLS = 53;
@@ -35,22 +36,26 @@ export default class ActivityCalendar extends Component {
}
const date = moment(cell.date).format("LL");
+ const username = this.args.user?.username;
if (cell.visited && cell.post_count === 0) {
- return i18n(
+ return i18nForOwner(
"discourse_rewind.reports.activity_calendar.cell_title.visited_no_posts",
- { date }
+ this.args.isOwnRewind,
+ { date, username }
);
} else if (cell.post_count > 0) {
- return i18n(
+ return i18nForOwner(
"discourse_rewind.reports.activity_calendar.cell_title.visited_with_posts",
- { date, count: cell.post_count }
+ this.args.isOwnRewind,
+ { date, count: cell.post_count, username }
);
}
- return i18n(
+ return i18nForOwner(
"discourse_rewind.reports.activity_calendar.cell_title.no_activity",
- { date }
+ this.args.isOwnRewind,
+ { date, username }
);
}
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/assignments.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/assignments.gjs
index 96613f060d1..51b62241cce 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/assignments.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/assignments.gjs
@@ -1,6 +1,7 @@
import Component from "@glimmer/component";
import number from "discourse/helpers/number";
import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
export default class Assignments extends Component {
get minimumDataThresholdMet() {
@@ -11,6 +12,14 @@ export default class Assignments extends Component {
);
}
+ get totalAssignedText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.assignments.total_assigned",
+ this.args.isOwnRewind,
+ { username: this.args.user?.username }
+ );
+ }
+
<template>
{{#if this.minimumDataThresholdMet}}
<div class="rewind-report-page --assignments">
@@ -40,7 +49,7 @@ export default class Assignments extends Component {
<div class="sticky-note --blue --rotate-left-small">
<div class="sticky-note__content">
<div class="sticky-note__title">
- {{i18n "discourse_rewind.reports.assignments.total_assigned"}}
+ {{this.totalAssignedText}}
</div>
<div class="sticky-note__value">
{{number @report.data.total_assigned}}
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-posts.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-posts.gjs
index b6e8d1d66dd..7fb18903ba8 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-posts.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-posts.gjs
@@ -5,20 +5,29 @@ import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
import getURL from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
export default class BestPosts extends Component {
rankClass(idx) {
return `rank-${idx + 1}`;
}
+ get titleText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.best_posts.title",
+ this.args.isOwnRewind,
+ {
+ count: this.args.report.data.length,
+ username: this.args.user?.username,
+ }
+ );
+ }
+
<template>
{{#if @report.data.length}}
<div class="rewind-report-page --best-posts">
<h2 class="rewind-report-title">
- {{i18n
- "discourse_rewind.reports.best_posts.title"
- }}
+ {{this.titleText}}
</h2>
<div class="rewind-report-container">
{{#each @report.data as |post idx|}}
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-topics.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-topics.gjs
index fe9b4ef2658..fed3649c9b2 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-topics.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/best-topics.gjs
@@ -5,20 +5,29 @@ import concatClass from "discourse/helpers/concat-class";
import replaceEmoji from "discourse/helpers/replace-emoji";
import getURL from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
export default class BestTopics extends Component {
rankClass(idx) {
return `rank-${idx + 1}`;
}
+ get titleText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.best_topics.title",
+ this.args.isOwnRewind,
+ {
+ count: this.args.report.data.length,
+ username: this.args.user?.username,
+ }
+ );
+ }
+
<template>
{{#if @report.data.length}}
<div class="rewind-report-page --best-topics">
<h2 class="rewind-report-title">
- {{i18n
- "discourse_rewind.reports.best_topics.title"
- }}
+ {{this.titleText}}
</h2>
<div class="rewind-report-container">
<div class="rewind-card">
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs
index 427b8cfc9e8..6456c9031e8 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs
@@ -5,6 +5,7 @@ import avatar from "discourse/helpers/avatar";
import number from "discourse/helpers/number";
import getURL from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
const BotMessage = <template>
<div class="chat-message__avatar">🤖</div>
@@ -24,7 +25,7 @@ const BotMessage = <template>
const UserMessage = <template>
<div class="chat-message__bubble">
<div class="chat-message__author">
- {{i18n "discourse_rewind.reports.chat_usage.you"}}
+ {{@authorText}}
</div>
{{#if @replyKey}}
<div class="chat-message__text">
@@ -51,6 +52,67 @@ export default class ChatUsage extends Component {
);
}
+ get authorText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.chat_usage.author",
+ this.args.isOwnRewind,
+ { username: this.args.user?.username }
+ );
+ }
+
+ get message1Text() {
+ return i18nForOwner(
+ "discourse_rewind.reports.chat_usage.message_1",
+ this.args.isOwnRewind,
+ {
+ count: this.args.report.data.total_messages,
+ username: this.args.user?.username,
+ }
+ );
+ }
+
+ get message2Text() {
+ return i18nForOwner(
+ "discourse_rewind.reports.chat_usage.message_2",
+ this.args.isOwnRewind,
+ {
+ dm_count: this.args.report.data.dm_message_count,
+ channel_count: this.args.report.data.unique_dm_channels,
+ username: this.args.user?.username,
+ }
+ );
+ }
+
+ get message3Text() {
+ return i18nForOwner(
+ "discourse_rewind.reports.chat_usage.message_3",
+ this.args.isOwnRewind,
+ {
+ count: this.args.report.data.total_reactions_received,
+ username: this.args.user?.username,
+ }
+ );
+ }
+
+ get message4Text() {
+ return i18nForOwner(
+ "discourse_rewind.reports.chat_usage.message_4",
+ this.args.isOwnRewind,
+ {
+ length: this.args.report.data.avg_message_length,
+ username: this.args.user?.username,
+ }
+ );
+ }
+
+ get message5Text() {
+ return i18nForOwner(
+ "discourse_rewind.reports.chat_usage.message_5",
+ this.args.isOwnRewind,
+ { username: this.args.user?.username }
+ );
+ }
+
<template>
{{#if this.minimumDataThresholdMet}}
<div class="rewind-report-page --chat-usage">
@@ -70,67 +132,48 @@ export default class ChatUsage extends Component {
<div class="chat-window__messages">
<div class="chat-message --left">
- <BotMessage
- @message={{i18n
- "discourse_rewind.reports.chat_usage.message_1"
- count=(number @report.data.total_messages)
- }}
- />
+ <BotMessage @message={{htmlSafe this.message1Text}} />
</div>
<div class="chat-message --right">
- <UserMessage @user={{@user}} @replyKey="reply_1" />
+ <UserMessage
+ @user={{@user}}
+ @replyKey="reply_1"
+ @authorText={{this.authorText}}
+ />
</div>
<div class="chat-message --left">
- <BotMessage
- @message={{htmlSafe
- (i18n
- "discourse_rewind.reports.chat_usage.message_2"
- dm_count=(number @report.data.dm_message_count)
- channel_count=(number @report.data.unique_dm_channels)
- )
- }}
- />
+ <BotMessage @message={{htmlSafe this.message2Text}} />
</div>
<div class="chat-message --right">
- <UserMessage @user={{@user}} @replyKey="reply_2" />
+ <UserMessage
+ @user={{@user}}
+ @replyKey="reply_2"
+ @authorText={{this.authorText}}
+ />
</div>
<div class="chat-message --left">
- <BotMessage
- @message={{htmlSafe
- (i18n
- "discourse_rewind.reports.chat_usage.message_3"
- count=(number @report.data.total_reactions_received)
- )
- }}
- />
+ <BotMessage @message={{htmlSafe this.message3Text}} />
</div>
<div class="chat-message --right">
- <UserMessage @user={{@user}} @replyKey="reply_3" />
+ <UserMessage
+ @user={{@user}}
+ @replyKey="reply_3"
+ @authorText={{this.authorText}}
+ />
</div>
<div class="chat-message --left">
- <BotMessage
- @message={{htmlSafe
- (i18n
- "discourse_rewind.reports.chat_usage.message_4"
- [email protected]_message_length
- )
- }}
- />
+ <BotMessage @message={{htmlSafe this.message4Text}} />
</div>
{{#if this.favoriteChannels.length}}
<div class="chat-message --left">
- <BotMessage
- @message={{i18n
- "discourse_rewind.reports.chat_usage.message_5"
- }}
- >
+ <BotMessage @message={{this.message5Text}}>
<div class="chat-message__channels">
{{#each this.favoriteChannels as |channel|}}
<a
@@ -151,7 +194,7 @@ export default class ChatUsage extends Component {
{{/if}}
<div class="chat-message --right">
- <UserMessage @user={{@user}}>
+ <UserMessage @user={{@user}} @authorText={{this.authorText}}>
<img
src={{getURL
"/plugins/discourse-rewind/images/dancing_baby.gif"
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/favorite-gifs.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/favorite-gifs.gjs
index 01932e2ab98..2808c9816b3 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/favorite-gifs.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/favorite-gifs.gjs
@@ -2,19 +2,25 @@ import Component from "@glimmer/component";
import icon from "discourse/helpers/d-icon";
import number from "discourse/helpers/number";
import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
export default class FavoriteGifs extends Component {
get favoriteGifs() {
return this.args.report.data.favorite_gifs ?? [];
}
+ get titleText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.favorite_gifs.title",
+ this.args.isOwnRewind,
+ { count: this.favoriteGifs.length, username: this.args.user?.username }
+ );
+ }
+
<template>
{{#if this.favoriteGifs.length}}
<div class="rewind-report-page --favorite-gifs">
- <h2 class="rewind-report-title">{{i18n
- "discourse_rewind.reports.favorite_gifs.title"
- count=this.favoriteGifs.length
- }}</h2>
+ <h2 class="rewind-report-title">{{this.titleText}}</h2>
<div class="rewind-report-subtitle">{{i18n
"discourse_rewind.reports.favorite_gifs.total_usage"
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/fbff.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/fbff.gjs
index 9ccc41517fa..ba7ec27af9b 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/fbff.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/fbff.gjs
@@ -1,40 +1,49 @@
+import Component from "@glimmer/component";
import { hash } from "@ember/helper";
import avatar from "discourse/helpers/bound-avatar-template";
import getURL from "discourse/lib/get-url";
-import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
-const FBFF = <template>
- <div class="rewind-report-page --fbff">
- <h2 class="rewind-report-title">
- {{i18n "discourse_rewind.reports.fbff.title"}}
- </h2>
- <div class="rewind-report-container">
- <div class="rewind-card">
- <div class="fbff-avatar-container">
- {{avatar
- @report.data.fbff.avatar_template
- "huge"
- }}
- <p class="fbff-avatar-name">@{{@report.data.fbff.username}}</p>
- </div>
- <div class="fbff-gif-container">
- <img
- class="fbff-gif"
- src={{getURL "/plugins/discourse-rewind/images/fbff.gif"}}
- />
- </div>
- <div class="fbff-avatar-container">
- {{avatar
- @report.data.yourself.avatar_template
- "huge"
- }}
- <p class="fbff-avatar-name">@{{@report.data.yourself.username}}</p>
+export default class FBFF extends Component {
+ get titleText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.fbff.title",
+ this.args.isOwnRewind,
+ { username: this.args.user?.username }
+ );
+ }
+
+ <template>
+ <div class="rewind-report-page --fbff">
+ <h2 class="rewind-report-title">
+ {{this.titleText}}
+ </h2>
+ <div class="rewind-report-container">
+ <div class="rewind-card">
+ <div class="fbff-avatar-container">
+ {{avatar
+ @report.data.fbff.avatar_template
+ "huge"
+ }}
+ <p class="fbff-avatar-name">@{{@report.data.fbff.username}}</p>
+ </div>
+ <div class="fbff-gif-container">
+ <img
+ class="fbff-gif"
+ src={{getURL "/plugins/discourse-rewind/images/fbff.gif"}}
+ />
+ </div>
+ <div class="fbff-avatar-container">
+ {{avatar
+ @report.data.yourself.avatar_template
+ "huge"
+ }}
+ <p class="fbff-avatar-name">@{{@report.data.yourself.username}}</p>
+ </div>
</div>
</div>
</div>
- </div>
-</template>;
-
-export default FBFF;
+ </template>
+}
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/invites.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/invites.gjs
index dea095b92d9..140e0f73cc3 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/invites.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/invites.gjs
@@ -4,6 +4,7 @@ import avatar from "discourse/helpers/bound-avatar-template";
import number from "discourse/helpers/number";
import getURL from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
export default class Invites extends Component {
get mostActiveInvitee() {
@@ -18,6 +19,14 @@ export default class Invites extends Component {
);
}
+ get subtitleText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.invites.guest_book_subtitle",
+ this.args.isOwnRewind,
+ { username: this.args.user?.username }
+ );
+ }
+
<template>
{{#if this.minimumDataThresholdMet}}
<div class="rewind-report-page --invites">
@@ -27,7 +36,7 @@ export default class Invites extends Component {
{{i18n "discourse_rewind.reports.invites.guest_book_title"}}
</div>
<div class="guest-book__subtitle">
- {{i18n "discourse_rewind.reports.invites.guest_book_subtitle"}}
+ {{this.subtitleText}}
</div>
</div>
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/most-viewed-categories.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/most-viewed-categories.gjs
index 54ea180463a..a0afdfb0531 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/most-viewed-categories.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/most-viewed-categories.gjs
@@ -6,7 +6,7 @@ import { action } from "@ember/object";
import concatClass from "discourse/helpers/concat-class";
import getURL from "discourse/lib/get-url";
import { eq } from "discourse/truth-helpers";
-import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
/**
* Component displaying most viewed categories in rewind report
@@ -16,6 +16,17 @@ import { i18n } from "discourse-i18n";
export default class MostViewedCategories extends Component {
@tracked openedCategoryId = null;
+ get titleText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.most_viewed_categories.title",
+ this.args.isOwnRewind,
+ {
+ count: this.args.report.data.length,
+ username: this.args.user?.username,
+ }
+ );
+ }
+
/**
* Handles click on folder-wrapper, we want to open
* the folder on click then navigate to it on second click.
@@ -35,10 +46,7 @@ export default class MostViewedCategories extends Component {
{{#if @report.data.length}}
<div class="rewind-report-page --most-viewed-categories">
<h2 class="rewind-report-title">
- {{i18n
- "discourse_rewind.reports.most_viewed_categories.title"
- }}
+ {{this.titleText}}
</h2>
<div class="rewind-report-container">
{{#each @report.data as |data|}}
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/most-viewed-tags.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/most-viewed-tags.gjs
index 1670d241a84..2d665f73bcb 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/most-viewed-tags.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/most-viewed-tags.gjs
@@ -6,11 +6,22 @@ import { action } from "@ember/object";
import concatClass from "discourse/helpers/concat-class";
import getURL from "discourse/lib/get-url";
import { eq } from "discourse/truth-helpers";
-import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
export default class MostViewedTags extends Component {
@tracked openedTag = null;
+ get titleText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.most_viewed_tags.title",
+ this.args.isOwnRewind,
+ {
+ count: this.args.report.data.length,
+ username: this.args.user?.username,
+ }
+ );
+ }
+
/**
* Handles click on folder-wrapper, we want to open
* the folder on click then navigate to it on second click.
@@ -29,10 +40,7 @@ export default class MostViewedTags extends Component {
<template>
{{#if @report.data.length}}
<div class="rewind-report-page --most-viewed-tags">
- <h2 class="rewind-report-title">{{i18n
- "discourse_rewind.reports.most_viewed_tags.title"
- }}</h2>
+ <h2 class="rewind-report-title">{{this.titleText}}</h2>
<div class="rewind-report-container">
{{#each @report.data as |data|}}
<a
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/new-user-interactions.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/new-user-interactions.gjs
index b077e64ee9d..3159e8fc651 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/new-user-interactions.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/new-user-interactions.gjs
@@ -1,5 +1,6 @@
import Component from "@glimmer/component";
import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
export default class NewUserInteractions extends Component {
get wavyWords() {
@@ -11,13 +12,19 @@ export default class NewUserInteractions extends Component {
return memberText.split(" ").map((word) => word.split(""));
}
+ get contributionsText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.new_user_interactions.contributions_helped",
+ this.args.isOwnRewind,
+ { username: this.args.user?.username }
+ );
+ }
+
<template>
<div class="rewind-report-page --new-user-interactions">
<div class="wordart-container">
<div class="wordart-text">
- {{i18n
- "discourse_rewind.reports.new_user_interactions.your_contributions_helped"
- }}
+ {{this.contributionsText}}
</div>
<div class="wordart-3d">
{{#each this.wavyWords as |word|}}
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reading-time.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reading-time.gjs
index 0058dd782f3..daf689cf9f5 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reading-time.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reading-time.gjs
@@ -3,6 +3,7 @@ import { concat } from "@ember/helper";
import { htmlSafe } from "@ember/template";
import getURL from "discourse/lib/get-url";
import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
export default class ReadingTime extends Component {
get readTimeString() {
@@ -19,6 +20,18 @@ export default class ReadingTime extends Component {
}
}
+ get bookComparisonText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.reading_time.book_comparison",
+ this.args.isOwnRewind,
+ {
+ readingTime: this.readTimeString,
+ bookTitle: this.args.report.data.book,
+ username: this.args.user?.username,
+ }
+ );
+ }
+
<template>
{{#if @report.data}}
<div class="rewind-report-page --reading-time">
@@ -27,13 +40,7 @@ export default class ReadingTime extends Component {
</h2>
<div class="rewind-card">
<p class="reading-time__text">
- {{htmlSafe
- (i18n
- "discourse_rewind.reports.reading_time.book_comparison"
- readingTitme=this.readTimeString
- )
- }}
+ {{htmlSafe this.bookComparisonText}}
</p>
<div class="reading-time__book">
<div class="book">
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/time-of-day-activity.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/time-of-day-activity.gjs
index 35b1c16c043..a280cd01b32 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/time-of-day-activity.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/time-of-day-activity.gjs
@@ -4,6 +4,7 @@ import { action } from "@ember/object";
import { htmlSafe } from "@ember/template";
import DButton from "discourse/components/d-button";
import { i18n } from "discourse-i18n";
+import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";
export default class TimeOfDayActivity extends Component {
@tracked isPlaying = false;
@@ -171,6 +172,14 @@ export default class TimeOfDayActivity extends Component {
return `${displayHour}${period}`;
}
+ get playButtonText() {
+ return i18nForOwner(
+ "discourse_rewind.reports.time_of_day_activity.play_button",
+ this.args.isOwnRewind,
+ { username: this.args.user?.username }
+ );
+ }
+
@action
stopWaveform() {
if (this.audioSource) {
@@ -374,10 +383,10 @@ export default class TimeOfDayActivity extends Component {
@action={{this.playWaveform}}
@icon={{if this.isPlaying "volume-xmark" "volume-high"}}
class="oscilloscope__play-btn {{if this.isPlaying '--playing'}}"
- @title={{if
+ title={{if
this.isPlaying
- "discourse_rewind.reports.time_of_day_activity.stop_button"
- "discourse_rewind.reports.time_of_day_activity.play_button"
+ (i18n "discourse_rewind.reports.time_of_day_activity.stop_button")
+ this.playButtonText
}}
/>
<svg viewBox="0 0 1200 200" class="oscilloscope__svg">
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/rewind.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/rewind.gjs
index 5f1c9722edc..f7c7ba4eb56 100644
--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/rewind.gjs
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/rewind.gjs
@@ -54,6 +54,10 @@ export default class Rewind extends Component {
return this.currentUser.id === this.args.user.id;
}
+ get isOwnRewind() {
+ return this.currentUser?.id === this.args.user.id;
+ }
+
@action
registerScrollWrapper(element) {
this.scrollWrapper = element;
@@ -376,7 +380,11 @@ export default class Rewind extends Component {
}}
{{#if ReportComponent}}
<div class={{concatClass "rewind-report" report.identifier}}>
- <ReportComponent @report={{report}} @user={{@user}} />
+ <ReportComponent
+ @report={{report}}
+ @user={{@user}}
+ @isOwnRewind={{this.isOwnRewind}}
+ />
</div>
{{/if}}
{{/let}}
diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/lib/rewind-i18n.js b/plugins/discourse-rewind/assets/javascripts/discourse/lib/rewind-i18n.js
new file mode 100644
index 00000000000..2eebdb113df
--- /dev/null
+++ b/plugins/discourse-rewind/assets/javascripts/discourse/lib/rewind-i18n.js
@@ -0,0 +1,6 @@
+import { i18n } from "discourse-i18n";
+
+export function i18nForOwner(key, isOwner, options = {}) {
+ const suffix = isOwner ? "" : "_others";
+ return i18n(`${key}${suffix}`, options);
+}
diff --git a/plugins/discourse-rewind/config/locales/client.en.yml b/plugins/discourse-rewind/config/locales/client.en.yml
index 68f22d5862d..8a0ab0a051b 100644
--- a/plugins/discourse-rewind/config/locales/client.en.yml
+++ b/plugins/discourse-rewind/config/locales/client.en.yml
@@ -43,15 +43,21 @@ en:
title: Activity Calendar
cell_title:
visited_no_posts: "You visited and lurked on %{date}, but made no posts."
+ visited_no_posts_others: "%{username} visited and lurked on %{date}, but made no posts."
visited_with_posts:
one: "You made %{count} post on %{date}."
other: "You made %{count} posts on %{date}."
+ visited_with_posts_others:
+ one: "%{username} made %{count} post on %{date}."
+ other: "%{username} made %{count} posts on %{date}."
no_activity: "You weren't around on %{date}."
+ no_activity_others: "%{username} wasn't around on %{date}."
top_words:
title: Word Usage
reading_time:
title: Reading time
- book_comparison: "You spent <code>%{readingTitme}</code> reading on our site! That's the time it would take to read through <i>%{bookTitle}</i>"
+ book_comparison: "You spent <code>%{readingTime}</code> reading on our site! That's the time it would take to read through <i>%{bookTitle}</i>"
+ book_comparison_others: "%{username} spent <code>%{readingTime}</code> reading on our site! That's the time it would take to read through <i>%{bookTitle}</i>"
post_used_reactions:
title: Most used reactions in topics
total_number: "Total number of reactions: %{count}"
@@ -59,24 +65,37 @@ en:
title: Most received reactions in topics
fbff:
title: Your FBFF (Forum Best Friend Forever)
+ title_others: "%{username}'s FBFF (Forum Best Friend Forever)"
most_viewed_categories:
title:
one: Your most viewed category
other: Your %{count} most viewed categories
+ title_others:
+ one: "%{username}'s most viewed category"
+ other: "%{username}'s %{count} most viewed categories"
most_viewed_tags:
title:
one: Your most viewed tag
other: Your %{count} most viewed tags
+ title_others:
+ one: "%{username}'s most viewed tag"
+ other: "%{username}'s %{count} most viewed tags"
best_topics:
view_topic: View topic
title:
one: Your best topic
other: Your %{count} best topics
+ title_others:
+ one: "%{username}'s best topic"
+ other: "%{username}'s %{count} best topics"
best_posts:
view_post: View post
title:
one: Your best post
other: Your %{count} best posts
+ title_others:
+ one: "%{username}'s best post"
+ other: "%{username}'s %{count} best posts"
ai_usage:
title: AI Usage
total_requests: Total Requests
@@ -91,6 +110,7 @@ en:
assignments:
title: Assignments
total_assigned: Assigned to me
+ total_assigned_others: Assigned to them
completed: Assignments completed
pending: Assignments pending
assigned_by_user: Assignments given
@@ -105,22 +125,31 @@ en:
favorite_channels: Favorite Channels
messages: messages
bot_name: XxRewindBotxX
- you: You
+ author: You
+ author_others: "%{username}"
channel_title: "#chat-activity"
status_online: "● online"
message_1: "You sent <strong>%{count}</strong> messages this year!"
+ message_1_others: "%{username} sent <strong>%{count}</strong> messages this year!"
reply_1: "lol awesome B-)"
message_2: "You had <strong>%{dm_count}</strong> DM conversations with <strong>%{channel_count}</strong> different people or groups"
+ message_2_others: "%{username} had <strong>%{dm_count}</strong> DM conversations with <strong>%{channel_count}</strong> different people or groups"
reply_2: "cOo0oL :D"
message_3: "People loved your messages! You got <strong>%{count}</strong> reactions ❤️"
+ message_3_others: "People loved their messages! They got <strong>%{count}</strong> reactions ❤️"
reply_3: "r0fl rAwr 8-)"
message_4: "Your average message length was <strong>%{length}</strong> characters"
+ message_4_others: "Their average message length was <strong>%{length}</strong> characters"
message_5: "Your favorite channels:"
+ message_5_others: "Their favorite channels:"
dancing_baby_alt: "Dancing baby"
favorite_gifs:
title:
one: Your favorite GIF
other: Your %{count} favorite GIFs
+ title_others:
+ one: "%{username}'s favorite GIF"
+ other: "%{username}'s %{count} favorite GIFs"
total_usage:
one: Used %{count} time
other: Used %{count} times total
@@ -131,12 +160,14 @@ en:
redemption_rate: Acceptance Rate
avg_trust_level: Avg Trust Level
invitee_impact: Impact of Your Invitees
+ invitee_impact_others: Impact of Their Invitees
invitee_posts: Posts Created
invitee_topics: Topics Started
invitee_likes: Likes Given
most_active_invitee: Most Active Invitee
guest_book_title: Guest Book
guest_book_subtitle: Your Community Invitations
+ guest_book_subtitle_others: "%{username}'s Community Invitations"
label_invitations_sent: "Invitations sent:"
label_guests_joined: "Invites accepted:"
label_acceptance_rate: "Acceptance rate:"
@@ -150,6 +181,9 @@ en:
subtitle:
one: You helped %{count} new user this year
other: You helped %{count} new users this year
+ subtitle_others:
+ one: "%{username} helped %{count} new user this year"
+ other: "%{username} helped %{count} new users this year"
new_member:
one: "%{count} new member"
other: "%{count} new members"
@@ -159,10 +193,12 @@ en:
replies: Replies to Posts
mentions: Mentions
topics_with_new_users: Topics with New Users
- your_contributions_helped: your contributions helped
+ contributions_helped: your contributions helped
+ contributions_helped_others: their contributions helped
time_of_day_activity:
title: Daily Activity Rhythm
play_button: Play your activity as sound
+ play_button_others: Play their activity as sound
stop_button: Stop audio playback
writing_analysis:
title: Writing Analysis