Localize NavItems (#106)

* Localize NavItems

* Fix group titles.
This commit is contained in:
Stan Silvert 2020-09-21 08:54:42 -04:00 committed by GitHub
parent 48e13b7204
commit c656d6acee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 14 deletions

View file

@ -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<RealmRepresentation[]>(
@ -48,7 +50,7 @@ export const PageNav: React.FunctionComponent = () => {
to={"/" + path}
isActive={activeItem === "/" + path}
>
{title}
{t(title)}
</NavItem>
);
};
@ -64,21 +66,21 @@ export const PageNav: React.FunctionComponent = () => {
<RealmSelector realmList={realmList || []} />
</NavItem>
</NavList>
<NavGroup title="Manage">
{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")}
<NavGroup title={t("manage")}>
{makeNavItem("clients", "clients")}
{makeNavItem("clientScopes", "client-scopes")}
{makeNavItem("realmRoles", "realm-roles")}
{makeNavItem("users", "users")}
{makeNavItem("groups", "groups")}
{makeNavItem("sessions", "sessions")}
{makeNavItem("events", "events")}
</NavGroup>
<NavGroup title="Configure">
{makeNavItem("Realm settings", "realm-settings")}
{makeNavItem("Authentication", "authentication")}
{makeNavItem("Identity providers", "identity-providers")}
{makeNavItem("User federation", "user-federation")}
<NavGroup title={t("configure")}>
{makeNavItem("realmSettings", "realm-settings")}
{makeNavItem("authentication", "authentication")}
{makeNavItem("identityProviders", "identity-providers")}
{makeNavItem("userFederation", "user-federation")}
</NavGroup>
</Nav>
}

View file

@ -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"
}
}