Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action } from "@ember/object";
import { classNames } from "@ember-decorators/component";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
import { selectKitOptions } from "select-kit/components/select-kit";

Expand All @@ -22,16 +22,16 @@ export default class AssignActionsDropdown extends DropdownSelectBoxComponent {
{
id: "unassign",
icon: this.group ? "group-times" : "user-xmark",
name: I18n.t("discourse_assign.unassign.title"),
description: I18n.t("discourse_assign.unassign.help", {
name: i18n("discourse_assign.unassign.title"),
description: i18n("discourse_assign.unassign.help", {
username: this.assignee,
}),
},
{
id: "reassign",
icon: "users",
name: I18n.t("discourse_assign.reassign.title"),
description: I18n.t("discourse_assign.reassign.help"),
name: i18n("discourse_assign.reassign.title"),
description: i18n("discourse_assign.reassign.help"),
},
]);
}
Expand All @@ -43,8 +43,8 @@ export default class AssignActionsDropdown extends DropdownSelectBoxComponent {
options = options.concat({
id: `unassign_post_${postId}`,
icon: assignee.username ? "user-xmark" : "group-times",
name: I18n.t("discourse_assign.unassign_post.title"),
description: I18n.t("discourse_assign.unassign_post.help", {
name: i18n("discourse_assign.unassign_post.title"),
description: i18n("discourse_assign.unassign_post.help", {
username: assignee.username || assignee.name,
}),
});
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/components/assigned-to-post.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import DButton from "discourse/components/d-button";
import DropdownMenu from "discourse/components/dropdown-menu";
import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
import DMenu from "float-kit/components/d-menu";

export default class AssignedToPost extends Component {
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/components/assignment.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { TextArea } from "@ember/legacy-built-in-components";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
import ComboBox from "select-kit/components/combo-box";
import not from "truth-helpers/helpers/not";
import AssigneeChooser from "./assignee-chooser";
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/components/modal/assign-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { TrackedObject } from "@ember-compat/tracked-built-ins";
import I18n from "I18n";
import { i18n } from "discourse-i18n";

export default class AssignUser extends Component {
@service taskActions;
Expand All @@ -26,7 +26,7 @@ export default class AssignUser extends Component {
break;
}

return I18n.t(
return i18n(
`discourse_assign.assign${i18nSuffix}.${
this.model.reassign ? "reassign_title" : "title"
}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import DModalCancel from "discourse/components/d-modal-cancel";
import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
import TopicAssignments from "../topic-assignments";

export default class EditTopicAssignments extends Component {
Expand All @@ -16,9 +16,9 @@ export default class EditTopicAssignments extends Component {

get title() {
if (this.topic.isAssigned() || this.topic.hasAssignedPosts()) {
return I18n.t("edit_assignments_modal.title");
return i18n("edit_assignments_modal.title");
} else {
return I18n.t("discourse_assign.assign_modal.title");
return i18n("discourse_assign.assign_modal.title");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from "@ember/component";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "I18n";
import discourseComputed from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";

export default class RemindAssignsFrequency extends Component {
@discourseComputed(
Expand All @@ -22,7 +22,7 @@ export default class RemindAssignsFrequency extends Component {
@discourseComputed("user.reminders_frequency")
availableFrequencies(userRemindersFrequency) {
return userRemindersFrequency.map((freq) => ({
name: I18n.t(freq.name),
name: i18n(freq.name),
value: freq.value,
selected: false,
}));
Expand Down
7 changes: 3 additions & 4 deletions assets/javascripts/discourse/components/topic-assignments.gjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import i18n from "discourse-common/helpers/i18n";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
import ComboBox from "select-kit/components/combo-box";
import Assignment from "./assignment";

Expand All @@ -21,9 +20,9 @@ export default class TopicAssignments extends Component {
#toComboBoxOption(assignment) {
const option = { id: assignment.id };
if (assignment.targetType === "Topic") {
option.name = I18n.t("edit_assignments_modal.topic");
option.name = i18n("edit_assignments_modal.topic");
} else {
option.name = `${I18n.t("edit_assignments_modal.post")} #${
option.name = `${i18n("edit_assignments_modal.post")} #${
assignment.postNumber
}`;
}
Expand Down
25 changes: 11 additions & 14 deletions assets/javascripts/discourse/components/topic-level-assign-menu.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getOwner } from "@ember/application";
import { htmlSafe } from "@ember/template";
import { renderAvatar } from "discourse/helpers/user-avatar";
import { iconHTML } from "discourse-common/lib/icon-library";
import I18n from "I18n";
import { iconHTML } from "discourse/lib/icon-library";
import { i18n } from "discourse-i18n";
import EditTopicAssignments from "../components/modal/edit-topic-assignments";

const DEPENDENT_KEYS = [
Expand Down Expand Up @@ -113,7 +113,7 @@ function extractPostId(buttonId) {

function editAssignmentsButton() {
const icon = iconHTML("pencil");
const label = I18n.t("discourse_assign.topic_level_menu.edit_assignments");
const label = i18n("discourse_assign.topic_level_menu.edit_assignments");
return {
id: "reassign",
name: htmlSafe(label),
Expand All @@ -123,9 +123,7 @@ function editAssignmentsButton() {

function reassignToSelfButton() {
const icon = iconHTML("user-plus");
const label = I18n.t(
"discourse_assign.topic_level_menu.reassign_topic_to_me"
);
const label = i18n("discourse_assign.topic_level_menu.reassign_topic_to_me");
return {
id: "reassign-self",
name: htmlSafe(label),
Expand All @@ -139,10 +137,9 @@ function unassignFromTopicButton(topic) {
const icon = topic.assigned_to_user
? avatarHtml(topic.assigned_to_user, "small")
: iconHTML("user-xmark");
const label = I18n.t(
"discourse_assign.topic_level_menu.unassign_from_topic",
{ username }
);
const label = i18n("discourse_assign.topic_level_menu.unassign_from_topic", {
username,
});

return {
id: "unassign",
Expand Down Expand Up @@ -173,11 +170,11 @@ function unassignFromPostButton(postId, assignment) {
icon = iconHTML("group-times");
}

const label = I18n.t("discourse_assign.topic_level_menu.unassign_from_post", {
const label = i18n("discourse_assign.topic_level_menu.unassign_from_post", {
assignee,
post_number: assignment.post_number,
});
const dataName = I18n.t(
const dataName = i18n(
"discourse_assign.topic_level_menu.unassign_from_post_help",
{
assignee,
Expand All @@ -193,14 +190,14 @@ function unassignFromPostButton(postId, assignment) {

function topicLevelUnassignButton(assignees) {
const avatars = topicLevelUnassignButtonAvatars(assignees);
const label = `<span class="unassign-label">${I18n.t(
const label = `<span class="unassign-label">${i18n(
"discourse_assign.topic_level_menu.unassign_with_ellipsis"
)}</span>`;

return {
id: null,
name: htmlSafe(
I18n.t("discourse_assign.topic_level_menu.unassign_with_ellipsis")
i18n("discourse_assign.topic_level_menu.unassign_with_ellipsis")
),
label: htmlSafe(`${avatars}${label}`),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { set } from "@ember/object";
import { sort } from "@ember/object/computed";
import UserMenuNotificationsList from "discourse/components/user-menu/notifications-list";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
import UserMenuAssignsListEmptyState from "./assigns-list-empty-state";

export default class UserMenuAssignNotificationsList extends UserMenuNotificationsList {
Expand All @@ -14,15 +14,15 @@ export default class UserMenuAssignNotificationsList extends UserMenuNotificatio
}

get dismissTitle() {
return I18n.t("user.dismiss_assigned_tooltip");
return i18n("user.dismiss_assigned_tooltip");
}

get showAllHref() {
return `${this.currentUser.path}/activity/assigned`;
}

get showAllTitle() {
return I18n.t("user_menu.view_all_assigned");
return i18n("user_menu.view_all_assigned");
}

get itemsCacheKey() {
Expand All @@ -47,7 +47,7 @@ export default class UserMenuAssignNotificationsList extends UserMenuNotificatio
}

get dismissConfirmationText() {
return I18n.t("notifications.dismiss_confirmation.body.assigns", {
return i18n("notifications.dismiss_confirmation.body.assigns", {
count: this._unreadAssignedNotificationsCount,
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import I18n from "I18n";
import { i18n } from "discourse-i18n";

export default class AssignableInteractionFields extends Component {
assignableLevelOptions = [
{ name: I18n.t("groups.alias_levels.nobody"), value: 0 },
{ name: I18n.t("groups.alias_levels.only_admins"), value: 1 },
{ name: I18n.t("groups.alias_levels.mods_and_admins"), value: 2 },
{ name: I18n.t("groups.alias_levels.members_mods_and_admins"), value: 3 },
{ name: I18n.t("groups.alias_levels.owners_mods_and_admins"), value: 4 },
{ name: I18n.t("groups.alias_levels.everyone"), value: 99 },
{ name: i18n("groups.alias_levels.nobody"), value: 0 },
{ name: i18n("groups.alias_levels.only_admins"), value: 1 },
{ name: i18n("groups.alias_levels.mods_and_admins"), value: 2 },
{ name: i18n("groups.alias_levels.members_mods_and_admins"), value: 3 },
{ name: i18n("groups.alias_levels.owners_mods_and_admins"), value: 4 },
{ name: i18n("groups.alias_levels.everyone"), value: 99 },
];

get assignableLevel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { alias } from "@ember/object/computed";
import { service } from "@ember/service";
import UserTopicsList from "discourse/controllers/user-topics-list";
import BulkSelectHelper from "discourse/lib/bulk-select-helper";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseDebounce from "discourse-common/lib/debounce";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse/lib/environment";

export default class GroupAssignedShow extends UserTopicsList {
@service taskActions;
Expand Down
6 changes: 3 additions & 3 deletions assets/javascripts/discourse/controllers/group-assigned.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseDebounce from "discourse-common/lib/debounce";
import discourseComputed from "discourse-common/utils/decorators";
import discourseDebounce from "discourse/lib/debounce";
import discourseComputed from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse/lib/environment";

export default class GroupAssigned extends Controller {
@service router;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import UserTopicsList from "discourse/controllers/user-topics-list";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseDebounce from "discourse-common/lib/debounce";
import getURL from "discourse-common/lib/get-url";
import { iconHTML } from "discourse-common/lib/icon-library";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "I18n";
import discourseDebounce from "discourse/lib/debounce";
import discourseComputed from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse/lib/environment";
import getURL from "discourse/lib/get-url";
import { iconHTML } from "discourse/lib/icon-library";
import { i18n } from "discourse-i18n";

export default class UserActivityAssigned extends UserTopicsList {
@service taskActions;
Expand All @@ -27,7 +27,7 @@ export default class UserActivityAssigned extends UserTopicsList {
@discourseComputed
emptyStateBody() {
return htmlSafe(
I18n.t("user.no_assignments_body", {
i18n("user.no_assignments_body", {
preferencesUrl: getURL("/my/preferences/notifications"),
icon: iconHTML("user-plus"),
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { withPluginApi } from "discourse/lib/plugin-api";
import I18n from "I18n";
import { i18n } from "discourse-i18n";

export default {
name: "assign-extend-user-messages",
Expand All @@ -11,7 +11,7 @@ export default {
if (currentUser?.can_assign && api.addUserMessagesNavigationDropdownRow) {
api.addUserMessagesNavigationDropdownRow(
"userPrivateMessages.assigned",
I18n.t("discourse_assign.assigned"),
i18n("discourse_assign.assigned"),
"user-plus"
);
}
Expand Down
24 changes: 9 additions & 15 deletions assets/javascripts/discourse/initializers/assign-user-menu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { htmlSafe } from "@ember/template";
import { withPluginApi } from "discourse/lib/plugin-api";
import { emojiUnescape } from "discourse/lib/text";
import I18n from "I18n";
import { i18n } from "discourse-i18n";
import UserMenuAssignNotificationsList from "../components/user-menu/assigns-list";

export default {
Expand All @@ -26,14 +26,11 @@ export default {
return class extends NotificationItemBase {
get linkTitle() {
if (this.isGroup()) {
return I18n.t(
`user.assigned_to_group.${this.postOrTopic()}`,
{
group_name: this.notification.data.display_username,
}
);
return i18n(`user.assigned_to_group.${this.postOrTopic()}`, {
group_name: this.notification.data.display_username,
});
}
return I18n.t(`user.assigned_to_you.${this.postOrTopic()}`);
return i18n(`user.assigned_to_you.${this.postOrTopic()}`);
}

get icon() {
Expand All @@ -50,13 +47,10 @@ export default {
get description() {
return htmlSafe(
emojiUnescape(
I18n.t(
`user.assignment_description.${this.postOrTopic()}`,
{
topic_title: this.notification.fancy_title,
post_number: this.notification.post_number,
}
)
i18n(`user.assignment_description.${this.postOrTopic()}`, {
topic_title: this.notification.fancy_title,
post_number: this.notification.post_number,
})
)
);
}
Expand Down
Loading