Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate message "Nothing to show" #319

Merged
merged 9 commits into from
Jul 20, 2021
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import './FileNavigator.less';
import PropTypes from 'prop-types';
import { SortDirection } from 'react-virtualized';
import clickOutside from 'react-click-outside';
import { find, isEqual } from 'lodash';

import ListView from '../ListView';
import LocationBar from '../LocationBar';
import Notifications from '../Notifications';
import Toolbar from '../Toolbar';
import { SortDirection } from 'react-virtualized';
import { find, isEqual } from 'lodash';
import clickOutside from 'react-click-outside';
import ContextMenu from '../ContextMenu';
import rawToReactElement from '../raw-to-react-element';
import { createHistory, pushToHistory } from '../history';

import './FileNavigator.less';

function hasContext(capability, context) {
return capability.availableInContexts && capability.availableInContexts.indexOf(context) !== -1;
}
Expand Down Expand Up @@ -501,6 +503,7 @@ class FileNavigator extends Component {
items={resourceChildren}
layout={listViewLayout}
layoutOptions={viewLayoutOptions}
locale={apiOptions.locale}
>
<Notifications
className="oc-fm--file-navigator__notifications"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import './ListView.less';
import 'react-virtualized/styles.css';
import PropTypes from 'prop-types';
import { range } from 'lodash';
import nanoid from 'nanoid';
import detectIt from 'detect-it';
// TBD individual imports from 'react-virtualized' to decrease bundle size?
// ex. import Table from 'react-virtualized/dist/commonjs/Table'
import { Table, AutoSizer, SortDirection } from 'react-virtualized';
import 'react-virtualized/styles.css';
import { ContextMenuTrigger } from "react-contextmenu";

import NoFilesFoundStub from '../NoFilesFoundStub';
import Row from './Row.react';
import ScrollOnMouseOut from '../ScrollOnMouseOut';
import { range } from 'lodash';
import nanoid from 'nanoid';
import detectIt from 'detect-it';
import rawToReactElement from '../raw-to-react-element';
import WithSelection from './withSelectionHOC';
import { isDef } from './utils';

import './ListView.less';


const ROW_HEIGHT = 38;
const HEADER_HEIGHT = 38;
const SCROLL_STRENGTH = 80;
Expand Down Expand Up @@ -44,7 +47,8 @@ const propTypes = {
onSelection: PropTypes.func,
onSort: PropTypes.func,
onKeyDown: PropTypes.func,
onRef: PropTypes.func
onRef: PropTypes.func,
locale: PropTypes.string
};
const defaultProps = {
rowContextMenuId: nanoid(),
Expand All @@ -63,7 +67,8 @@ const defaultProps = {
onSelection: () => {},
onSort: () => {},
onKeyDown: () => {},
onRef: () => {}
onRef: () => {},
locale: 'en'
};

export default
Expand Down Expand Up @@ -250,7 +255,7 @@ class ListView extends Component {
rowRenderer={Row({
selection, lastSelected, loading, contextMenuId: rowContextMenuId, hasTouch: HAS_TOUCH
})}
noRowsRenderer={NoFilesFoundStub}
noRowsRenderer={() => <NoFilesFoundStub locale={this.props.locale}/>}
onRowClick={onRowClick}
onRowRightClick={onRowRightClick}
onRowDoubleClick={onRowDoubleClick}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import React from 'react';
import './NoFilesFoundStub.less';
import PropTypes from "prop-types";
import Svg from '@opuscapita/react-svg/lib/SVG';
const nothingToShowIcon = require('@opuscapita/svg-icons/lib/add_to_photos.svg');

// TODO Add localization
export default () => (
import getMessage from '../../../translations'

import './NoFilesFoundStub.less';

const NoFilesFoundStub = ({ locale }) => (
<div className="oc-fm--no-files-found-stub">
<Svg
className="oc-fm--no-files-found-stub__icon"
svg={nothingToShowIcon}
/>
<div className="oc-fm--no-files-found-stub__title">
Nothing to show
{getMessage(locale, "common.NoFilesFoundStub.nothingToShow")}
</div>
<div className="oc-fm--no-files-found-stub__sub-title">
Use toolbar or context menu to perform available actions
{getMessage(locale, "common.NoFilesFoundStub.useContextMenu")}
</div>
{/*
<div className="oc-fm--no-files-found-stub__sub-title">
Expand All @@ -23,3 +26,13 @@ export default () => (
*/}
</div>
);

NoFilesFoundStub.propTypes = {
locale: PropTypes.string
};

NoFilesFoundStub.defaultProps = {
locale: 'en',
};

export default NoFilesFoundStub;
4 changes: 4 additions & 0 deletions packages/client-react/src/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ const translations = {
en: {
'common.Toolbar.moveForward': 'Move forward',
'common.Toolbar.moveBack': 'Move back',
'common.NoFilesFoundStub.nothingToShow': 'Nothing to show',
'common.NoFilesFoundStub.useContextMenu': 'Use toolbar or context menu to perform available actions'
},
fr: {
'common.Toolbar.moveForward': 'Avancer',
'common.Toolbar.moveBack': 'Revenir en arrière',
'common.NoFilesFoundStub.nothingToShow': 'Aucun élément à afficher',
'common.NoFilesFoundStub.useContextMenu': 'Utilisez la barre d\'outil ou le menu contextuel pour faire une action'
},
zh: {
'common.Toolbar.moveForward': '向前',
Expand Down