Commit 9b96bd33 authored by Matija Obreza's avatar Matija Obreza
Browse files

Added ES translations

parent 66b647d8
......@@ -7,4 +7,6 @@ const { API_URL, CLIENT_ID, CLIENT_SECRET } = {
API_URL: 'http://localhost:8080',
};
showGenesysUI(API_URL, CLIENT_ID, CLIENT_SECRET, document.getElementById('genesys'), { institute: { code: [ 'COL003', 'BEL084', 'ETH013' ] } });
const queryLang = document.location.search && document.location.search.substr(1) || undefined;
showGenesysUI(API_URL, CLIENT_ID, CLIENT_SECRET, document.getElementById('genesys'), { institute: { code: [ 'COL003', 'BEL084', 'ETH013' ] } }, queryLang);
......@@ -22,6 +22,12 @@
<li class="nav-item">
<a class="nav-link" href="#/api-info">API Info</a>
</li>
<li class="nav-item">
<a class="nav-link" href=".">EN</a>
</li>
<li class="nav-item">
<a class="nav-link" href="?es">ES</a>
</li>
</ul>
<hr />
<div class="container-fluid" id="genesys"></div>
......
......@@ -31,6 +31,12 @@
<li class="nav-item">
<a class="nav-link" href="#/api-info">API Info</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html">EN</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html?es">ES*</a>
</li>
</ul>
</div>
<hr />
......@@ -52,9 +58,12 @@
const CLIENTKEY = 'gnE1dPz5CWnbn0IsFvL8iSP1QDxBpmU0';
const FILTER = { institute: { code: ['COL003', 'BEL084'] } };
const queryLang = document.location.search && document.location.search.substr(1) || undefined;
genesys.showGenesysUI(APIURL, CLIENTID, CLIENTKEY,
document.getElementById('genesys-container'),
FILTER
FILTER,
queryLang,
);
</script>
</body>
......
......@@ -2,11 +2,13 @@ import i18n from 'i18next';
// import HttpApi from 'i18next-http-backend';
import { initReactI18next } from 'react-i18next';
import transEn from 'locales/en/translations.json';
import transEs from 'locales/es/translations.json';
import transRu from 'locales/ru/translations.json';
// Bundled resources
const resources = {
en: { translations: { ...transEn } },
es: { translations: { ...transEs } },
ru: { translations: { ...transRu } },
};
// console.log('Translations', resources);
......
......@@ -8,5 +8,99 @@
},
"error": {
"notFound": "Not Found"
},
"estimatedNumberOfItems": "{{count, number}} {{what, lowercase}}",
"accession": {
"model": "Accession",
"model_plural": "Accessions",
"doi": "Accession DOI",
"crop": "Crop",
"acceNumb": "Accession number",
"accessionName": "Accession name",
"taxonomy": "Scientific name",
"holdingInstitute": "Holding institute",
"instituteCode": "Institute code",
"genus": "Genus",
"countryOfOrigin": "Provenance of material",
"species": "Specific epithet",
"sampStat": "Biological status",
"storageType": "Type of germplasm storage",
"datasets": "Datasets",
"subsets": "Subsets",
"coll": {
"collCode": "Collecting institute code",
"collNumb": "Collecting number",
"collDate": "Collecting date of sample",
"collMissId": "Collecting mission identifier",
"collName": "Collecting institute name",
"collSite": "Location of collecting site",
"collSrc": "Collecting source"
},
"geo": {
"latitude": "Latitude of collecting site",
"longitude": "Longitude of collecting site",
"uncertainty": "Coordinate uncertainty",
"datum": "Geodetic datum",
"method": "Georeferencing method",
"elevation": "Elevation of collecting site"
},
"storage": {
"10": "Seed collection",
"11": "Short term seed collection",
"12": "Medium term seed collection",
"13": "Long term seed collection",
"20": "Field collection",
"30": "In vitro collection",
"40": "Cryopreserved collection",
"50": "DNA collection",
"99": "Other"
},
"sampleStatus": {
"100": "Wild",
"110": "Natural",
"120": "Semi-natural/wild",
"130": "Semi-natural/sown",
"200": "Weedy",
"300": "Traditional cultivar/Landrace",
"400": "Breeding/Research Material",
"410": "Breeders Line",
"411": "Synthetic population",
"412": "Hybrid",
"413": "Founder stock/base population",
"414": "Inbred line",
"415": "Segregating population",
"416": "Clonal selection",
"420": "Genetic stock",
"421": "Mutant",
"422": "Cytogenetic stocks",
"423": "Other genetic stocks",
"500": "Advanced/improved cultivar",
"600": "GMO",
"999": "Other"
},
"collectingSource": {
"10": "Wild habitat",
"11": "Forest or woodland",
"12": "Shrubland",
"13": "Grassland",
"14": "Desert or tundra",
"15": "Aquatic habitat",
"20": "Field or cultivated habitat",
"21": "Field",
"22": "Orchard",
"23": "Backyard, kitchen or home garden (urban, peri-urban or rural)",
"24": "Fallow land",
"25": "Pasture",
"26": "Farm store",
"27": "Threshing floor",
"28": "Park",
"30": "Market or shop",
"40": "Institute, Experimental station, Research organization, Genebank",
"50": "Seed company",
"60": "Weedy, disturbed or ruderal habitat",
"61": "Roadside",
"62": "Field margin",
"99": "Other"
}
}
}
{
"loading": "Cargando",
"pag": {
"first": "Primera",
"prev": "Atrás",
"next": "Adelante",
"last": "Última"
},
"error": {
"notFound": "No encontrado"
},
"accession": {
"model": "Accesión",
"model_plural": "Accesiones",
"crop": "Cultivo",
"acceNumb": "Número de accesión",
"accessionName": "Nombre de la accesión",
"datasets": "Conjuntos de datos",
"subsets": "Subconjuntos",
"doi": "DOI de la accesión",
"sampStat": "Estado biológico",
"taxonomy": "Taxonomía",
"instituteCode": "Código de la institución",
"countryOfOrigin": "Procedencia del material",
"coll": {
"collCode": "Código de la institución de colecta",
"collNumb": "Número de colecta",
"collDate": "Fecha de la muestra de colecta",
"collMissId": "Identificador de la misión de colecta",
"collName": "Nombre de la institución de colecta",
"collSite": "Ubicación de la instalación de colecta",
"collSrc": "Origen de la colecta"
},
"geo": {
"latitude": "Latitud de la instalación de colecta",
"longitude": "Longitud de la instalación de colecta",
"uncertainty": "Inexactitud de las coordenadas",
"datum": "Datos geodésico",
"method": "Método de georreferenciación",
"elevation": "Elevación de la instalación de colecta"
},
"storage": {
"10": "Colección de semillas",
"11": "Colección de semillas a corto plazo",
"12": "Colección de semillas a medio plazo",
"13": "Colección de semillas a largo plazo",
"20": "Colección de campo",
"30": "Colección in vitro",
"40": "Colección criopreservada",
"50": "Colección de ADN",
"99": "Otros"
},
"sampleStatus": {
"100": "Silvestre",
"110": "Natural",
"120": "Seminatural/silvestre",
"130": "Seminatural/sembrado",
"200": "Maleza",
"300": "Variedad cultivada tradicional/raza autóctona",
"400": "Cría/material de investigación",
"410": "Línea de cultivadores",
"411": "Población sintética",
"412": "Híbrido",
"413": "Población fundadora/población base",
"414": "Línea pura",
"415": "Población segregante",
"416": "Selección clonal",
"420": "Material genético",
"421": "Mutante",
"422": "Materiales citogenéticos",
"423": "Otros materiales genéticos",
"500": "Variedad cultivada avanzada/mejorada",
"600": "OGM",
"999": "Otros"
},
"collectingSource": {
"10": "Hábitat silvestre",
"11": "Bosque o zonas arboladas",
"12": "Matorral",
"13": "Pradera",
"14": "Desierto o tundra",
"15": "Hábitat acuático",
"20": "Campo o hábitat cultivado",
"21": "Campo",
"22": "Huerto de árboles frutales",
"23": "Patio trasero, cocina o huerto casero (urbano, periurbano o rural)",
"24": "Tierra en barbecho",
"25": "Pastura",
"26": "Granja",
"27": "Era",
"28": "Parque",
"30": "Mercado o tienda",
"40": "Institución, centro experimental, organismo investigador, banco genético",
"50": "Empresa de semillas",
"60": "Hábitat con maleza, degradado o ruderal",
"61": "Junto a la carretera",
"62": "A la orilla del campo",
"99": "Otros"
}
}
}
......@@ -50,25 +50,28 @@ class AccessionDetailsPage extends React.Component<IAccessionDetailsPage & WithT
return (
<>
<h1>{ details.accessionNumber }</h1>
{ details.doi && <Property title="DOI" value={ details.doi } index={ propertyIndex++ }/> }
{ details.accessionName && <Property title="Accession name" value={ details.accessionName } index={ propertyIndex++ }/> }
{ details.doi && <Property title={ t('accession.doi') } value={ details.doi } index={ propertyIndex++ }/> }
{ details.accessionName && <Property title={ t('accession.accessionName') } value={ details.accessionName } index={ propertyIndex++ }/> }
{ details.taxonomy &&
<Property title="Species" value={ <span dangerouslySetInnerHTML={ { __html: details.taxonomy.taxonNameHtml } } /> } index={ propertyIndex++ }/>
<Property title={ t('accession.taxonomy') } value={ <span dangerouslySetInnerHTML={ { __html: details.taxonomy.taxonNameHtml } } /> } index={ propertyIndex++ }/>
}
{ details.institute && details.institute.fullName &&
<Property title="Holding institute" value={ details.institute.fullName } index={ propertyIndex++ }/>
<Property title={ t('accession.holdingInstitute') } value={ details.institute.fullName } index={ propertyIndex++ }/>
}
{ details.historic &&
<Property title="Historic accession" value={ 'This is a historic record of an accession' } index={ propertyIndex++ }/>
}
{ details.institute && details.institute.code &&
<Property title="Institute code" value={ details.institute.code } index={ propertyIndex++ }/>
<Property title={ t('accession.instituteCode') } value={ details.institute.code } index={ propertyIndex++ }/>
}
{ details.institute && details.institute.owner &&
<Property title="Data provider" value={ details.institute.owner.name } index={ propertyIndex++ }/>
}
{ details.sampStat &&
<Property title={ t('accession.sampStat') } value={ t(`accession.sampleStatus.${details.sampStat}`) } index={ propertyIndex++ }/>
}
{ details.countryOfOrigin &&
<Property title="Origin of material" value={ details.countryOfOrigin.name } index={ propertyIndex++ }/>
<Property title={ t('accession.countryOfOrigin') } value={ details.countryOfOrigin.name } index={ propertyIndex++ }/>
}
{ details.ancest &&
<Property title="Ancestral information (pedigree)" value={ details.ancest } index={ propertyIndex++ }/>
......@@ -89,21 +92,21 @@ class AccessionDetailsPage extends React.Component<IAccessionDetailsPage & WithT
{ details.coll &&
<>
<h3 className="mt-4">Collecting site</h3>
<Property title="Site" value={ details.coll.collSite } index={ propertyIndex++ }/>
<Property title="Collecting date" value={ details.coll.collDate } index={ propertyIndex++ }/>
<Property title="Collecting mission" value={ details.coll.collMissId } index={ propertyIndex++ }/>
<Property title="Collecting code" value={ details.coll.collCode } index={ propertyIndex++ }/>
<Property title="Collecting institute" value={ details.coll.collName } index={ propertyIndex++ }/>
<Property title={ t('accession.coll.collSite') } value={ details.coll.collSite } index={ propertyIndex++ }/>
<Property title={ t('accession.coll.collDate') } value={ details.coll.collDate } index={ propertyIndex++ }/>
<Property title={ t('accession.coll.collMissId') } value={ details.coll.collMissId } index={ propertyIndex++ }/>
<Property title={ t('accession.coll.collCode') } value={ details.coll.collCode } index={ propertyIndex++ }/>
<Property title={ t('accession.coll.collName') } value={ details.coll.collName } index={ propertyIndex++ }/>
</>
}
{ details.geo &&
<>
<h3 className="mt-4">Georeference</h3>
<Property title="Latitude" value={ details.geo.latitude } index={ propertyIndex++ }/>
<Property title="Longitude" value={ details.geo.longitude } index={ propertyIndex++ }/>
<Property title="Datum" value={ details.geo.datum } index={ propertyIndex++ }/>
<Property title="Coordinate uncertainty" value={ details.geo.uncertainty } index={ propertyIndex++ }/>
<Property title="Elevation" value={ details.geo.elevation } index={ propertyIndex++ }/>
<Property title={ t('accession.geo.latitude') } value={ details.geo.latitude } index={ propertyIndex++ }/>
<Property title={ t('accession.geo.longitude') } value={ details.geo.longitude } index={ propertyIndex++ }/>
<Property title={ t('accession.geo.datum') } value={ details.geo.datum } index={ propertyIndex++ }/>
<Property title={ t('accession.geo.uncertainty') } value={ details.geo.uncertainty } index={ propertyIndex++ }/>
<Property title={ t('accession.geo.elevation') } value={ details.geo.elevation } index={ propertyIndex++ }/>
</>
}
......@@ -122,7 +125,7 @@ class AccessionDetailsPage extends React.Component<IAccessionDetailsPage & WithT
{ accession.subsets && accession.subsets.length > 0 &&
<>
<h2 className="mt-4">Subsets</h2>
<h2 className="mt-4">{ t('accession.subsets') }</h2>
{ accession.subsets.map((subset, idx) => (
<div key={ idx }>
<h5>{ subset.title }</h5>
......@@ -134,7 +137,7 @@ class AccessionDetailsPage extends React.Component<IAccessionDetailsPage & WithT
{ accession.datasets && accession.datasets.length > 0 &&
<>
<h2 className="mt-4">Datasets</h2>
<h2 className="mt-4">{ t('accession.datasets') }</h2>
{ accession.datasets.map((dataset, idx) => (
<div key={ idx }>
<h5>{ dataset.title }</h5>
......
......@@ -8,6 +8,7 @@ import Accession from '@genesys/client/model/accession/Accession';
import FilteredPage, { IPageRequest } from '@genesys/client/model/FilteredPage';
import Pagination from './Pagination';
import { AccessionFilters } from './AccessionFilters';
import { withTranslation, WithTranslation } from 'react-i18next';
interface IAccessionListPageState {
filter: AccessionFilter;
......@@ -19,7 +20,7 @@ interface IAccessionListPageProps {
location: any;
}
export default class AccessionListPage extends React.Component<IAccessionListPageProps, IAccessionListPageState> {
class AccessionListPage extends React.Component<IAccessionListPageProps & WithTranslation, IAccessionListPageState> {
public constructor(props) {
super(props);
......@@ -73,25 +74,26 @@ export default class AccessionListPage extends React.Component<IAccessionListPag
public render() {
const { accessions } = this.state;
const { t } = this.props;
if (accessions === null) {
return (
<div>Loading...</div>
<div>{ t('loading') }</div>
);
} else {
return (
<>
<h1>{ accessions.totalElements } accessions</h1>
<h1>{ t('estimatedNumberOfItems', { count: accessions.totalElements, what: t('accession.model', { count: accessions.totalElements }) }) }</h1>
<AccessionFilters filter={ this.state.filter } applyFilter={ this.applyFilter } key={ `filters-${accessions.filterCode}` }/>
<Pagination loadData={ this.loadData } paged={ accessions }>
<table className="table table-striped">
<thead className="thead-dark">
<tr>
<th>Crop</th>
<th>Accession</th>
<th>Name</th>
<th>Species</th>
<th>Provenance</th>
<th>Improvement status</th>
<th>{ t('accession.crop') }</th>
<th>{ t('accession.acceNumb') }</th>
<th>{ t('accession.accessionName') }</th>
<th>{ t('accession.taxonomy') }</th>
<th>{ t('accession.countryOfOrigin') }</th>
<th>{ t('accession.sampStat') }</th>
</tr>
</thead>
<tbody>
......@@ -102,7 +104,7 @@ export default class AccessionListPage extends React.Component<IAccessionListPag
<td>{ a.accessionName }</td>
<td><span dangerouslySetInnerHTML={ { __html: a.taxonomy.taxonNameHtml } } /></td>
<td>{ a.countryOfOrigin && a.countryOfOrigin.name }</td>
<td>{ a.sampStat }</td>
<td>{ a.sampStat && t(`accession.sampleStatus.${a.sampStat}`) }</td>
</tr>
)) }
</tbody>
......@@ -113,3 +115,5 @@ export default class AccessionListPage extends React.Component<IAccessionListPag
}
};
}
export default withTranslation()(AccessionListPage);
Markdown is supported
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