8000 l18n for client names in device activity by ssilvert · Pull Request #32920 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Closed
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
10 changes: 9 additions & 1 deletion js/apps/account-ui/src/account-security/DeviceActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,20 @@ export const DeviceActivity = () => {
}
};

const removeSpecialChars = (clientName: string): string => {
if (clientName.startsWith("${") && clientName.endsWith("}")) {
return clientName.substring(2, clientName.length - 1);
}

return clientName;
};

Comment on lines +90 to +97
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already logic that does this and also looks up the name in the bundle

Suggested change
const removeSpecialChars = (clientName: string): string => {
if (clientName.startsWith("${") && clientName.endsWith("}")) {
return clientName.substring(2, clientName.length - 1);
}
return clientName;
};
import { label } from "@keycloak/keycloak-ui-shared";

const makeClientsString = (clients: ClientRepresentation[]): string => {
let clientsString = "";
clients.forEach((client, index) => {
let clientName: string;
if (client.clientName !== "") {
clientName = t(client.clientName as TFuncKey);
clientName = t(removeSpecialChars(client.clientName) as TFuncKey);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
clientName = t(removeSpecialChars(client.clientName) as TFuncKey);
clientName = label(t, client.clientName);

} else {
clientName = client.clientId;
}
Expand Down
0