Commit 3e5a15b3 authored by Matija Obreza's avatar Matija Obreza
Browse files

Documentation for customizing translations

parent 013612c4
......@@ -55,6 +55,18 @@ Add a container `<div>` to your HTML page and initialize the Genesys UI with the
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}/', // tile server url for the base layer
attribution: 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ' // attribution data
},
},
i18n: {
en: {
translations: {
// No customizations
}
},
es: {
translations: {
// No customizations
}
}
}
};
......@@ -84,6 +96,7 @@ to *@geneesys-pgr/ui-embedded*:
|`clientSecret` | **Required** | Ditto. |
|`filter` |`undefined` | Allows for narrowing the scope of requested accession data from Genesys API. <br />To filter for accessions from your genebank, use: `{ institute: { code: ['XXX000'] } }` with the FAO WIEWS Code of your genebank. Default `undefined` value will return all accessions. |
|`language`|*en*| Specify the language of the user interface.<br />Fully supported: `en`, `zh-TW`<br />Partially supported: `es` |
| `i18n` | `{ ... }` | See *Customizing translations* |
|`title`| *Genesys:* | HTML page title prefix |
| `accession` | `{ ... }` | See *Accession* configuration options |
| `shoppingCart` | `{ ... }` | See *Shopping cart* configuration options |
......@@ -138,13 +151,37 @@ The map is **disabled by default**. To allow users to see map of accession colle
|`baseMap.url`|[World_Light_Gray_Base](https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}/)| Tile server template URL for the base map layer. |
|`baseMap.attribution`|Tiles &copy; ...| Map base layer attribution. |
# Translating Embedded Genesys
*Embedded Genesys* is developed in English.
The [en/translations.json](src/locales/en/translations.json) lists all labels currently in use by the library.
The library is translated by friends in our community members to other languages, listed in [src/locales](src/locales/).
Help us make *Embedded Genesys* available in your language or improve the current translations at
**https://www.transifex.com/crop-trust/embedded-genesys/content/**
We welcome your contributions!
## Customizing translations
It is possible that the translations bundled with the library do not match your needs.
You may customize translations of individual labels by listing them in the `i18n` property of the `genesysConfig`.
```js
const genesysConfig = {
i18n: {
es: { // customizations for Spanish labels
translations: { // 'translations' is mandatory
"pagetitle": {
"accessionList": "Accesiones" // customize the translation of 'pagetitle.accessionList'
}
}
}
}
```
**Note:** the complete list of labels is available in [en/translations.json](src/locales/en/translations.json).
# License and Disclaimer
......
......@@ -22,16 +22,12 @@ const genesysConfig: Config = {
i18n: {
en: {
translations: {
'pagetitle': {
'accessionList': 'Genesys Accessions'
}
// No customizations
}
},
fr: {
es: {
translations: {
'accession': {
'doi': 'DOI'
}
// No customizations
}
}
},
......
......@@ -85,7 +85,7 @@ export function showOverview(holdingNode: HTMLElement, config: Config) {
const { apiUrl, clientId, clientKey, language } = config;
reconfigureServiceAxios({ apiUrl });
initI18n(language);
initI18n(language, config.i18n);
store.dispatch(setConfig(config));
checkAccessTokens(apiUrl, clientId, clientKey).then( (result) => {
......
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