Loris icon indicating copy to clipboard operation
Loris copied to clipboard

Translation proof-of-concept

Open maximemulder opened this issue 4 months ago • 9 comments

This PR is a proof-of-concept PR for the bilingual LORIS project. It implements a small translation infrastructure for the LORIS React code. It does not tackle back-end matters such as the database schema (supported languages, user preferences...) and translation files.

This PR uses the React i18next library, which is the most popular library for making bilingual projects with React, and is compatible with external translation files.

This PR adds a (completely unstyled for now) language menu in the header that allows to choose a language, and updates the contents of the page depending on the chosen language.

For now, only the MRI violations page has a few translations. (I chose this module because it uses functional React components). To translate class components, see the withTranslation component that passes the translation function as a prop to the class.

It is important that there is a single instance of React-i18next in the browser so that there is no library duplication and that the modules are correctly synchronized, hence why the library is added as an external dependency.

maximemulder avatar Oct 08 '24 16:10 maximemulder