Skip to content

Commit

Permalink
Translations for collapsed roles
Browse files Browse the repository at this point in the history
This patch switches to using a translation key and not a hard-coded
string.
  • Loading branch information
lkiesow committed Jun 5, 2024
1 parent aa31d3e commit 708fe2a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/users/partials/UsersRolesCell.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import React from "react";
import { useTranslation } from "react-i18next";

/**
* This component renders the roles cells of users in the table view
*/
const UsersRolesCell = ({
row
}: any) => {
const { t } = useTranslation();

const getRoleString = () => {
let displayRoles = [];
let roleCountUI = 0;
Expand All @@ -25,13 +28,16 @@ const UsersRolesCell = ({
}

if (roleCountUI > 0) {
displayRoles.push(`${roleCountUI} UI roles`);
const desc = t('USERS.USERS.TABLE.COLLAPSED.UI');
displayRoles.push(`${roleCountUI} ${desc}`);
}
if (roleCountAPI > 0) {
displayRoles.push(`${roleCountAPI} API roles`);
const desc = t('USERS.USERS.TABLE.COLLAPSED.API');
displayRoles.push(`${roleCountAPI} ${desc}`);
}
if (roleCountCaptureAgent > 0) {
displayRoles.push(`${roleCountUI} capture agent roles`);
const desc = t('USERS.USERS.TABLE.COLLAPSED.CAPTURE_AGENT');
displayRoles.push(`${roleCountCaptureAgent} ${desc}`);
}

return displayRoles.join(', ');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,11 @@
"USERNAME": "Username",
"EMAIL": "Email",
"ROLES": "Roles",
"COLLAPSED": {
"UI": "user interface roles",
"API": "API roles",
"CAPTURE_AGENT": "capture agent roles"
},
"TYPE": "Type",
"PROVIDER": "Provider",
"ACTION": "Actions",
Expand Down

0 comments on commit 708fe2a

Please sign in to comment.