fixed translations

This commit is contained in:
Julie Plantey 2022-08-04 15:15:55 +02:00
parent c59cced54b
commit 324b1628f6
4 changed files with 51 additions and 40 deletions

View File

@ -147,7 +147,10 @@ export const BrowseStep = ({
<Breadcrumbs <Breadcrumbs
onChangeFolder={onChangeFolder} onChangeFolder={onChangeFolder}
as="nav" as="nav"
label="hello" label={formatMessage({
id: getTrad('header.breadcrumbs.nav.label'),
defaultMessage: 'Folders navigation',
})}
breadcrumbs={breadcrumbs} breadcrumbs={breadcrumbs}
currentFolderId={queryObject?.folder} currentFolderId={queryObject?.folder}
/> />

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import { useIntl } from 'react-intl';
import { import {
Crumb, Crumb,
@ -10,7 +11,10 @@ import {
import { CrumbSimpleMenuAsync } from './CrumbSimpleMenuAsync'; import { CrumbSimpleMenuAsync } from './CrumbSimpleMenuAsync';
import { BreadcrumbsDefinition } from '../../constants'; import { BreadcrumbsDefinition } from '../../constants';
export const Breadcrumbs = ({ breadcrumbs, onChangeFolder, currentFolderId, ...props }) => ( export const Breadcrumbs = ({ breadcrumbs, onChangeFolder, currentFolderId, ...props }) => {
const { formatMessage } = useIntl();
return (
<BaseBreadcrumbs {...props}> <BaseBreadcrumbs {...props}>
{breadcrumbs.map((crumb, index) => { {breadcrumbs.map((crumb, index) => {
if (Array.isArray(crumb)) { if (Array.isArray(crumb)) {
@ -37,7 +41,7 @@ export const Breadcrumbs = ({ breadcrumbs, onChangeFolder, currentFolderId, ...p
to={onChangeFolder ? undefined : crumb.href} to={onChangeFolder ? undefined : crumb.href}
onClick={onChangeFolder && (() => onChangeFolder(crumb.id))} onClick={onChangeFolder && (() => onChangeFolder(crumb.id))}
> >
{crumb.label} {crumb.label?.id ? formatMessage(crumb.label) : crumb.label}
</CrumbLink> </CrumbLink>
); );
} }
@ -47,12 +51,13 @@ export const Breadcrumbs = ({ breadcrumbs, onChangeFolder, currentFolderId, ...p
key={`breadcrumb-${crumb?.id ?? 'root'}`} key={`breadcrumb-${crumb?.id ?? 'root'}`}
isCurrent={index + 1 === breadcrumbs.length} isCurrent={index + 1 === breadcrumbs.length}
> >
{crumb.label} {crumb.label?.id ? formatMessage(crumb.label) : crumb.label}
</Crumb> </Crumb>
); );
})} })}
</BaseBreadcrumbs> </BaseBreadcrumbs>
); );
};
Breadcrumbs.defaultProps = { Breadcrumbs.defaultProps = {
currentFolderId: undefined, currentFolderId: undefined,

View File

@ -1,8 +1,10 @@
import getTrad from './getTrad';
const getBreadcrumbDataML = folder => { const getBreadcrumbDataML = folder => {
let data = [ let data = [
{ {
id: null, id: null,
label: 'Media Library', label: { id: getTrad('plugin.name'), defaultMessage: 'MediaLibrary' },
}, },
]; ];

View File

@ -1,10 +1,11 @@
import getTrad from './getTrad';
import getFolderURL from './getFolderURL'; import getFolderURL from './getFolderURL';
const getBreadcrumbDataML = (folder, { pathname, query }) => { const getBreadcrumbDataML = (folder, { pathname, query }) => {
let data = [ let data = [
{ {
id: null, id: null,
label: 'Media Library', label: { id: getTrad('plugin.name'), defaultMessage: 'MediaLibrary' },
href: folder ? getFolderURL(pathname, query) : undefined, href: folder ? getFolderURL(pathname, query) : undefined,
}, },
]; ];