Modernizes the whole i18n stack:
- 48 translate([], {wait:true}) / translate() HOCs -> withTranslation()
- react.wait:true -> react.useSuspense:false
- whitelist -> supportedLngs; added compatibilityJSON: 'v3' so our
natural-language keys + v3 _plural layout keep working (custom
separators ss/eth/dj preserved)
- backends: xhr -> i18next-http-backend (client), sync-fs ->
i18next-fs-backend (server); dropped i18next-localstorage-cache
(was enabled:false); languagedetector 2 -> 8
- ReSendEmail: <Interpolate> (removed in v10) -> <Trans values={{email}}/>,
dropped the removed bare t export
- saveMissing handler signature (lngs, ns, key, fallbackValue)
Silences the per-component Translate/I18n legacy-context warnings.
Browser-verified es/en switch and <Trans> interpolation on /fires;
REST smoke byte-identical.
42 lines
1.7 KiB
JavaScript
42 lines
1.7 KiB
JavaScript
/* eslint-disable import/no-absolute-path */
|
|
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { withRouter } from 'react-router-dom';
|
|
import { LinkContainer } from 'react-router-bootstrap';
|
|
/* import { Nav, NavDropdown } from 'react-bootstrap'; */
|
|
import { withTranslation, Trans } from 'react-i18next';
|
|
import { testId } from '/imports/ui/components/Utils/TestUtils';
|
|
|
|
/*
|
|
FIXME:
|
|
navitem needs a nav-link class but does not works
|
|
https://github.com/react-bootstrap/react-bootstrap/issues/2644
|
|
className="nav-link"
|
|
so we did a custom NavLink
|
|
*/
|
|
import NavItem from '../NavItem/NavItem';
|
|
|
|
const AuthenticatedNavigation = ({ name, history, props }) => (
|
|
<ul className="navbar-nav">
|
|
{/* <Nav pullRight> */}
|
|
{/* <LinkContainer className="nav-item" anchorClassName="nav-link" to="/documents">
|
|
<NavItem eventKey={5} href="/documents">Documents</NavItem>
|
|
</LinkContainer> */}
|
|
{/* <LinkContainer className="nav-item" anchorClassName="nav-link" to="/subscriptions">
|
|
<NavItem eventKey={5} href="/subscriptions"><Trans>Mis alertas</Trans></NavItem>
|
|
</LinkContainer> */}
|
|
<LinkContainer id={testId('profile')} className="nav-item" anchorClassName="nav-link" to="/profile">
|
|
<NavItem eventKey={5.1} href="/profile">{name}</NavItem>
|
|
</LinkContainer>
|
|
<LinkContainer id={testId('logout')} className="nav-item" anchorClassName="nav-link" to="/logout">
|
|
<NavItem eventKey={5.2} onClick={() => history.push('/logout')} href="/logout"><Trans i18nKey="Cerrar sesión">Cerrar sesión</Trans></NavItem>
|
|
</LinkContainer>
|
|
{/* </Nav> */}
|
|
</ul>
|
|
);
|
|
|
|
AuthenticatedNavigation.propTypes = {
|
|
name: PropTypes.string.isRequired
|
|
};
|
|
|
|
export default withTranslation()(withRouter(AuthenticatedNavigation));
|