diff --git a/jam-ui/cypress/integration/layout/navigation.spec.js b/jam-ui/cypress/integration/layout/navigation.spec.js index bb561f20c..a14827598 100644 --- a/jam-ui/cypress/integration/layout/navigation.spec.js +++ b/jam-ui/cypress/integration/layout/navigation.spec.js @@ -68,5 +68,22 @@ describe("Top Navigation", () => { }) }) + describe('locale switch', () => { + beforeEach(() => { + cy.stubAuthenticate() + cy.visit('/') + }) + + it("translate", () => { + cy.get('.card-header').contains('Home page') + cy.get('[data-testid=langSwitch]').contains('ES').click() + cy.get('.card-header').contains('Página de inicio') + cy.get('.card-header').should('not.contain', 'Home page') + cy.get('[data-testid=langSwitch]').contains('EN').click() + cy.get('.card-header').contains('Home page') + cy.get('.card-header').should('not.contain', 'Página de inicio') + }) + }) + }); diff --git a/jam-ui/package-lock.json b/jam-ui/package-lock.json index 86a81f498..a6aab32b7 100644 --- a/jam-ui/package-lock.json +++ b/jam-ui/package-lock.json @@ -9923,6 +9923,14 @@ } } }, + "html-parse-stringify": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz", + "integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==", + "requires": { + "void-elements": "3.1.0" + } + }, "html-webpack-plugin": { "version": "4.0.0-beta.11", "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.0.0-beta.11.tgz", @@ -10067,6 +10075,14 @@ "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz", "integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==" }, + "i18next": { + "version": "21.3.3", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-21.3.3.tgz", + "integrity": "sha512-Wv5arCT9pK35nfhOzTdS64T7JpPcoqnkOEidxc4zF0DZ8KetpvmnkO+uWkXy+DFz6zWzPX7U9bIemwBqpFRprw==", + "requires": { + "@babel/runtime": "^7.12.0" + } + }, "iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -15666,6 +15682,25 @@ "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.11.1.tgz", "integrity": "sha512-lBt428oU03dNUF5qZy5xqEdANaH3L/ilKWQS2t8wD6zF7FypOv46kEkZmg+oHf3n2xgeGYJgbMIGtYExsfKJ8A==" }, + "react-i18next": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.12.0.tgz", + "integrity": "sha512-M9BT+hqVG03ywrl+L7CK74ugK+4jIo7AeKJ17+g9BoqJz2+/aVbs8SIVXT4KMQ1rjIdcw+GcSRDy1CXjcz6tLQ==", + "requires": { + "@babel/runtime": "^7.14.5", + "html-parse-stringify": "^3.0.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.4.tgz", + "integrity": "sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } + }, "react-image-lightbox": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/react-image-lightbox/-/react-image-lightbox-5.1.1.tgz", @@ -19342,6 +19377,11 @@ "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==" }, + "void-elements": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", + "integrity": "sha1-YU9/v42AHwu18GYfWy9XhXUOTwk=" + }, "w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", diff --git a/jam-ui/package.json b/jam-ui/package.json index 54d6d51c4..855ec40e9 100644 --- a/jam-ui/package.json +++ b/jam-ui/package.json @@ -29,6 +29,7 @@ "emoji-mart": "^3.0.0", "fuse.js": "^6.4.3", "google-maps-react": "^2.0.6", + "i18next": "^21.3.3", "is_js": "^0.9.0", "leaflet": "^1.7.1", "leaflet.markercluster": "^1.4.1", @@ -53,6 +54,7 @@ "react-es6-progressbar.js": "^1.1.0", "react-flatpickr": "^3.10.6", "react-hook-form": "^7.11.1", + "react-i18next": "^11.12.0", "react-image-lightbox": "^5.1.1", "react-image-video-lightbox": "^2.0.1", "react-leaflet": "^2.7.0", diff --git a/jam-ui/src/components/dashboard/JKDashboardLoadingIndicator.js b/jam-ui/src/components/dashboard/JKDashboardLoadingIndicator.js index ffb2eea35..3133f792a 100644 --- a/jam-ui/src/components/dashboard/JKDashboardLoadingIndicator.js +++ b/jam-ui/src/components/dashboard/JKDashboardLoadingIndicator.js @@ -1,9 +1,12 @@ -import React from 'react' +import React from 'react'; +import { useTranslation } from 'react-i18next'; function JKDashboardLoadingIndicator() { + const {t} = useTranslation(); + return (
| Name | +{t('person_attributes.name', {ns: 'people'})} | - About + {t('person_attributes.about', {ns: 'people'})} | -Instruments | +{t('person_attributes.instruments', {ns: 'people'})} | -Action | +{t('actions', {ns: 'common'})} | {truncate(biography, 200)} {biography && biography.length > 200 && ( - {' '} more » + {' '} {t('more', {ns: 'common'})} » )} | @@ -81,7 +83,7 @@ const JKPerson = props => { - +
|---|