Commit 301a678a authored by Matija Obreza's avatar Matija Obreza
Browse files

Wrapper i18n

parent d43ce30b
......@@ -46,6 +46,10 @@
"subtitle": "List of crops registered with Genesys",
"title": "Crops"
},
"dashboard": {
"title": "My Dashboard",
"subtitle": "Manage data published on Genesys"
},
"dataset": {
"title": "Dataset details"
},
......@@ -53,6 +57,14 @@
"title": "Datasets",
"subtitle": "Datasets published by Genesys partners"
},
"descriptorlists": {
"title": "Crop descriptors",
"subtitle": "Compilations of crop descriptors"
},
"descriptors": {
"title": "Descriptor definitions",
"subtitle": "Genesys Catalog of published descriptor definitions"
},
"partner": {
"address": "Address",
"countries": "Countries",
......@@ -61,6 +73,14 @@
"urls": "Websites",
"wiewsCodes": "FAO WIEWS codes"
},
"partners": {
"title": "Genesys Partners",
"subtitle": "Partners in the Catalog of Phenotypic Datasets"
},
"userprofile": {
"title": "User profile",
"subtitle": "You can see and update your profile information here"
},
"vocab": {
"subtitle": "Commonly used controlled vocabularies",
"title": "Vocabularies"
......
......@@ -3,10 +3,16 @@ import { translate } from 'react-i18next';
import ContentHeader from 'ui/common/heading/ContentHeader';
import renderRoutes from 'ui/renderRoutes';
function Wrapper({route, match, t}: { route: any, match: any, t: any}) {
/**
* A simple wrapper renders a title with subtitle
*
* @param title Content header title
* @param subtitle Content header subtitle
*/
function Wrapper({route, match, t, route: { extraProps: { title, subtitle } }}: { route: any, match: any, t: any}) {
return (
<div>
<ContentHeader title={ t(route.extraProps.title) } subTitle={ t(route.extraProps.subtitle) }/>
<ContentHeader title={ t(title) } subTitle={ t(subtitle) }/>
{ renderRoutes(route.routes, match.path) }
</div>
);
......
......@@ -62,8 +62,8 @@ const routes = [
path: '/partners',
component: Wrapper,
extraProps: {
title: 'Genesys partners',
subtitle: 'Partners in the Catalog of Phenotypic Datasets',
title: 'p.partners.title',
subtitle: 'p.partners.subtitle',
},
routes: [
{
......@@ -94,8 +94,8 @@ const routes = [
path: '/descriptors',
component: Wrapper,
extraProps: {
title: 'Descriptor definitions',
subtitle: 'Genesys Catalog of published descriptor definitions',
title: 'p.descriptors.title',
subtitle: 'p.descriptors.subtitle',
},
routes: [
{
......@@ -177,8 +177,8 @@ const routes = [
path: '/descriptorlists',
component: Wrapper,
extraProps: {
title: 'Crop descriptors',
subtitle: 'Compilations of crop descriptors',
title: 'p.descriptorlists.title',
subtitle: 'p.descriptorlists.subtitle',
},
routes: [
{
......@@ -361,8 +361,8 @@ const routes = [
path: '/dashboard',
component: Wrapper,
extraProps: {
title: 'My Dashboard',
subtitle: 'Manage data published on Genesys',
title: 'p.dashboard.title',
subtitle: 'p.dashboard.subtitle',
},
auth: [ROLE_USER, ROLE_ADMINISTRATOR],
routes: [
......@@ -428,8 +428,8 @@ const routes = [
path: '/profile',
component: Wrapper,
extraProps: {
title: 'User profile',
subtitle: 'You can see and update your profile information here',
title: 'p.userprofile.title',
subtitle: 'p.userprofile.subtitle',
},
auth: [ROLE_USER, ROLE_ADMINISTRATOR],
routes: [
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment