feat(i18n): added i18next for user interface translations (#432)

This commit is contained in:
Priscila Oliveira
2020-03-08 16:45:07 +01:00
committed by GitHub
parent 8d4b3cee7e
commit 7428384b55
76 changed files with 1114 additions and 720 deletions

View File

@@ -1,4 +1,5 @@
import React, { useState, useContext } from 'react';
import { useTranslation } from 'react-i18next';
import storage from '../../utils/storage';
import { getRegistryURL } from '../../utils/url';
@@ -18,13 +19,14 @@ interface Props {
/* eslint-disable react/jsx-no-bind*/
const Header: React.FC<Props> = ({ withoutSearch }) => {
const { t } = useTranslation();
const appContext = useContext(AppContext);
const [isInfoDialogOpen, setOpenInfoDialog] = useState();
const [showMobileNavBar, setShowMobileNavBar] = useState();
const [showLoginModal, setShowLoginModal] = useState(false);
if (!appContext) {
throw Error('The app Context was not correct used');
throw Error(t('app-context-not-correct-used'));
}
const { user, scope, setUser } = appContext;
@@ -67,7 +69,7 @@ const Header: React.FC<Props> = ({ withoutSearch }) => {
<Search />
</InnerMobileNavBar>
<Button color="inherit" onClick={() => setShowMobileNavBar(false)}>
{'Cancel'}
{t('button.cancel')}
</Button>
</MobileNavBar>
)}