From 243a5008eb660914f7223fadec2d24919904dd3e Mon Sep 17 00:00:00 2001 From: Jack Reed <phillipjreed@gmail.com> Date: Thu, 27 Jun 2019 11:22:27 +0200 Subject: [PATCH] Add info for help w/ translations fixes #2806 --- README.md | 3 +++ src/locales/README.md | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/locales/README.md diff --git a/README.md b/README.md index 6a33d74e6..1b14c76d0 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 000000000..e21582f38 --- /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. -- GitLab