From c656d6acee5017c85685c27e5c7c5782e857dc59 Mon Sep 17 00:00:00 2001 From: Stan Silvert Date: Mon, 21 Sep 2020 08:54:42 -0400 Subject: [PATCH] Localize NavItems (#106) * Localize NavItems * Fix group titles. --- src/PageNav.tsx | 30 ++++++++++++++++-------------- src/common-messages.json | 15 +++++++++++++++ 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/PageNav.tsx b/src/PageNav.tsx index b8e10979f6..d1c5634dae 100644 --- a/src/PageNav.tsx +++ b/src/PageNav.tsx @@ -1,5 +1,6 @@ import React, { useState, useContext } from "react"; import { useHistory } from "react-router-dom"; +import { useTranslation } from "react-i18next"; import { Nav, NavItem, @@ -13,6 +14,7 @@ import { HttpClientContext } from "./http-service/HttpClientContext"; import { RealmRepresentation } from "./realm/models/Realm"; export const PageNav: React.FunctionComponent = () => { + const { t } = useTranslation("common"); const httpClient = useContext(HttpClientContext)!; const realmLoader = async () => { const response = await httpClient.doGet( @@ -48,7 +50,7 @@ export const PageNav: React.FunctionComponent = () => { to={"/" + path} isActive={activeItem === "/" + path} > - {title} + {t(title)} ); }; @@ -64,21 +66,21 @@ export const PageNav: React.FunctionComponent = () => { - - {makeNavItem("Clients", "clients")} - {makeNavItem("Client Scopes", "client-scopes")} - {makeNavItem("Realm Roles", "realm-roles")} - {makeNavItem("Users", "users")} - {makeNavItem("Groups", "groups")} - {makeNavItem("Sessions", "sessions")} - {makeNavItem("Events", "events")} + + {makeNavItem("clients", "clients")} + {makeNavItem("clientScopes", "client-scopes")} + {makeNavItem("realmRoles", "realm-roles")} + {makeNavItem("users", "users")} + {makeNavItem("groups", "groups")} + {makeNavItem("sessions", "sessions")} + {makeNavItem("events", "events")} - - {makeNavItem("Realm settings", "realm-settings")} - {makeNavItem("Authentication", "authentication")} - {makeNavItem("Identity providers", "identity-providers")} - {makeNavItem("User federation", "user-federation")} + + {makeNavItem("realmSettings", "realm-settings")} + {makeNavItem("authentication", "authentication")} + {makeNavItem("identityProviders", "identity-providers")} + {makeNavItem("userFederation", "user-federation")} } diff --git a/src/common-messages.json b/src/common-messages.json index b6baf60bcc..40608e92a4 100644 --- a/src/common-messages.json +++ b/src/common-messages.json @@ -21,6 +21,21 @@ "documentation": "Documentation", "enableHelpMode": "Enable help mode", + "manage": "Manage", + "clients": "Clients", + "clientScopes": "Client scopes", + "realmRoles": "Realm roles", + "users": "Users", + "groups": "Groups", + "sessions": "Sessions", + "events": "Events", + + "configure": "Configure", + "realmSettings": "Realm settings", + "authentication": "Authentication", + "identityProviders": "Identity providers", + "userFederation": "User federation", + "required": "Required field" } }