diff --git a/README.md b/README.md index 6a33d74e6ea05845bb8d11faab67175bdceb553a..1b14c76d0dbe95e8b6f103da6ff722dea69777cc 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ ## For Mirador Users You can quickly use and configure Mirador by remixing the [mirador-start](https://mirador-start.glitch.me/) Glitch. +## Adding translations to Mirador +For help with adding a translation, see [src/locales/README.md](src/locales/README.md) + ## Running Mirador locally Mirador local development requires [nodejs](https://nodejs.org/en/download/) to be installed. diff --git a/src/locales/README.md b/src/locales/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e21582f3813165983f0423f91f80ba7900bd7d7c --- /dev/null +++ b/src/locales/README.md @@ -0,0 +1,46 @@ +# Contributing a Mirador translation + +Mirador is built with internationalization and translation support. It uses a translation file and [react-i18next](https://react.i18next.com/) to provide translations in user interface elements. + +## Getting started +To contribute a new language to Mirador, you will need to convert the strings contained in [en/translation.json](en/translation.json) to the target language. + +So we would want to create a directory for the target language using the iso language code that copies from the `en/translation.json` file. e.g. `fr/translation.json`. + +```sh +$ mkdir src/locales/fr && cp src/locales/en/translation.json src/locales/fr/translation.json +``` + +For example, this subset of the English file: + +```javascript +// src/locales/en/translation.json +{ + "translation": { + "aboutThisItem": "About this item", + "addedFromUrl": "(Added from URL)", + "addManifestUrl": "Resource location", + "addManifestUrlHelp": "The URL of a IIIF resource", + "addResource": "Add resource", + "annotationCanvasLabel_1/1": "Item: [{{label}}]", +... +``` + +Would look like this in French. + +```javascript +// src/locales/fr/translation.json +{ + "translation": { + "aboutThisItem": "A propos de cet item", + "addedFromUrl": "(Ajouté depuis une URL)", + "addManifestUrl": "Emplacement de la ressource", + "addManifestUrlHelp": "L'URL de la ressource IIIF", + "addResource": "Ajouter une ressource", + "annotationCanvasLabel_1/1": "Item: [{{label}}]", +... +``` + +Strings contained in double curly braces `{{}}` should not be changed. + +The [`i18n.js`](../i18n.js) file should also be updated for the new language.