move username to i18n key (#17818)

Some languages structure phrases and sentences differently, so the username can't always be assumed to be the last item in the phrase. This change uses the Trans component to maintain the HTML formatting.
This commit is contained in:
Josh Hawkins 2025-04-19 20:05:49 -05:00 committed by GitHub
parent 9a786a50d6
commit 484ea10037
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -483,7 +483,7 @@
},
"changeRole": {
"title": "Change User Role",
"desc": "Update permissions for",
"desc": "Update permissions for <strong>{{username}}</strong>",
"roleInfo": {
"intro": "Select the appropriate role for this user:",
"admin": "Admin",

View File

@ -1,4 +1,4 @@
import { useTranslation } from "react-i18next";
import { Trans, useTranslation } from "react-i18next";
import { Button } from "../ui/button";
import {
Dialog,
@ -46,8 +46,14 @@ export default function RoleChangeDialog({
{t("users.dialog.changeRole.title")}
</DialogTitle>
<DialogDescription>
{t("users.dialog.changeRole.desc")}
<span className="font-medium"> {username}</span>
<Trans
i18nKey="users.dialog.changeRole.desc"
ns="views/settings"
values={{ username }}
components={{
strong: <span className="font-medium" />,
}}
/>
</DialogDescription>
</DialogHeader>