Skip to content

Commit

Permalink
TASK: Replace leftover usages of <I18n /> if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jan 27, 2025
1 parent 0885715 commit 3586459
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import {Icon} from '@neos-project/react-ui-components';
import {connect} from 'react-redux';
import {actions} from '@neos-project/neos-ui-redux-store';
import I18n, {translate} from '@neos-project/neos-ui-i18n';
import {translate} from '@neos-project/neos-ui-i18n';

import buttonTheme from './style.module.css';

Expand Down Expand Up @@ -39,13 +39,7 @@ export default class RestoreButtonItem extends React.PureComponent {
aria-hidden="true"
className={buttonTheme.dropDown__itemIcon}
/>
<I18n
id="impersonate.label.restoreUserButton"
sourceName="Main"
packageKey="Neos.Neos"
fallback={`Back to user "${originUser.fullName}"`}
params={{0: originUser.fullName}}
/>
{translate('Neos.Neos:Main:impersonate.label.restoreUserButton', 'Back to user "{0}"', {0: originUser.fullName})}
</button>
</li>
) : null);
Expand Down
6 changes: 3 additions & 3 deletions packages/neos-ui/src/Containers/Drawer/UserDropDown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {Icon, DropDown} from '@neos-project/react-ui-components';
import UserImage from './UserImage';
import RestoreButtonItem from './RestoreButtonItem';

import I18n from '@neos-project/neos-ui-i18n';
import {translate} from '@neos-project/neos-ui-i18n';

import style from './style.module.css';
@connect(state => ({
Expand Down Expand Up @@ -36,15 +36,15 @@ export default class UserDropDown extends PureComponent {
<li className={style.dropDown__item}>
<a title="User Settings" href={userSettingsUri}>
<Icon icon="wrench" aria-hidden="true" className={style.dropDown__itemIcon}/>
<I18n id="userSettings.label" sourceName="Modules" packageKey="Neos.Neos" fallback="User Settings"/>
{translate('Neos.Neos:Modules:userSettings.label', 'User Settings')}
</a>
</li>
<li className={style.dropDown__item}>
<form title="Logout" action={logoutUri} method="post" role="presentation">
<input type="hidden" name="__csrfToken" value={csrfToken}/>
<button onClick={e => e.stopPropagation()} type="submit" name="" value="logout">
<Icon icon="sign-out-alt" aria-hidden="true" className={style.dropDown__itemIcon}/>
<I18n id="logout" sourceName="Main" packageKey="Neos.Neos" fallback="Logout"/>
{translate('Neos.Neos:Main:logout', 'Logout')}
</button>
</form>
</li>
Expand Down
53 changes: 14 additions & 39 deletions packages/neos-ui/src/Containers/Modals/InsertMode/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {connect} from 'react-redux';
import {neos} from '@neos-project/neos-ui-decorators';

import {Button, Dialog, Icon} from '@neos-project/react-ui-components';
import I18n, {translate} from '@neos-project/neos-ui-i18n';
import {translate} from '@neos-project/neos-ui-i18n';

import {InsertModeSelector} from '@neos-project/neos-ui-containers';

Expand Down Expand Up @@ -81,41 +81,22 @@ export default class InsertModeModal extends PureComponent {

renderTitle() {
const {subjectContextPaths, referenceContextPath, operationType} = this.props;

const parameters = {
source: this.renderNodeLabel(subjectContextPaths),
target: this.renderNodeLabel([referenceContextPath])
};

let label = '';
if (operationType === actionTypes.CR.Nodes.COPY) {
label = translate('Neos.Neos:Main:copy__from__to--title', '', parameters);
} else if (operationType === actionTypes.CR.Nodes.CUT || operationType === actionTypes.CR.Nodes.MOVE) {
label = translate('Neos.Neos:Main:move__from__to--title', '', parameters);
}
return (
<div>
<Icon icon="clipboard"/>
<span className={style.modalTitle}>
{operationType === actionTypes.CR.Nodes.COPY &&
<I18n
key="copy"
id="Neos.Neos:Main:copy__from__to--title"
params={{
source: this.renderNodeLabel(subjectContextPaths),
target: this.renderNodeLabel([referenceContextPath])
}}
/>
}
{operationType === actionTypes.CR.Nodes.CUT &&
<I18n
key="move"
id="Neos.Neos:Main:move__from__to--title"
params={{
source: this.renderNodeLabel(subjectContextPaths),
target: this.renderNodeLabel([referenceContextPath])
}}
/>
}
{operationType === actionTypes.CR.Nodes.MOVE &&
<I18n
key="move"
id="Neos.Neos:Main:move__from__to--title"
params={{
source: this.renderNodeLabel(subjectContextPaths),
target: this.renderNodeLabel([referenceContextPath])
}}
/>
}
{label}
</span>
</div>
);
Expand Down Expand Up @@ -173,13 +154,7 @@ export default class InsertModeModal extends PureComponent {
>
<div className={style.modalContents}>
<p>
<I18n
id="Neos.Neos:Main:copy__from__to--description"
params={{
source: this.renderNodeLabel(subjectContextPaths),
target: this.renderNodeLabel([referenceContextPath])
}}
/>
{translate('Neos.Neos:Main:copy__from__to--description', '', {source: this.renderNodeLabel(subjectContextPaths), target: this.renderNodeLabel([referenceContextPath])})}
</p>
<InsertModeSelector
mode={this.state.mode}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {connect} from 'react-redux';

import {neos} from '@neos-project/neos-ui-decorators';
import {actions} from '@neos-project/neos-ui-redux-store';
import I18n, {translate} from '@neos-project/neos-ui-i18n';
import {translate} from '@neos-project/neos-ui-i18n';

import {Dialog, Button} from '@neos-project/react-ui-components';
import style from './style.module.css';
Expand All @@ -26,7 +26,7 @@ class KeyboardShortcutModal extends PureComponent {
renderShortcut = ({id, description, keys}) => (
<div key={id} className={style.keyboardShortcut}>
<div className={style.keyboardShortcut__label}>
<I18n id={`Neos.Neos.Ui:Main:Shortcut__${id}`} fallback={description} />
{translate(`Neos.Neos.Ui:Main:Shortcut__${id}`, description)}
</div>
<div className={style.keyboardShortcut__keys}>{keys}</div>
</div>
Expand All @@ -52,12 +52,12 @@ class KeyboardShortcutModal extends PureComponent {
return (
<Dialog
actions={[this.renderCloseAction()]}
title={<I18n fallback="Keyboard Shortcuts" />}
title="Keyboard Shortcuts"
isOpen={isOpen}
onRequestClose={() => close()}
>
<div className={style.keyboardShortcutIntroText}>
<I18n id={`Neos.Neos.Ui:Main:Shortcut__Introduction`} fallback={''} />
{translate('Neos.Neos.Ui:Main:Shortcut__Introduction')}
</div>
<div className={style.keyboardShortcutList}>
{hotkeyRegistry.getAllAsList().map(key => this.renderShortcut(key))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default class NodeCreationDialog extends PureComponent {

return (
<span>
<I18n fallback="Create new" id="createNew"/>&nbsp;
{translate('Neos.Neos:Main:createNew', 'Create new')}&nbsp;
<I18n id={label} fallback={label}/>
</span>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import {connect} from 'react-redux';

import {Button, Dialog} from '@neos-project/react-ui-components';
import I18n, {translate} from '@neos-project/neos-ui-i18n';
import {translate} from '@neos-project/neos-ui-i18n';

import {selectors, actions} from '@neos-project/neos-ui-redux-store';
import {neos} from '@neos-project/neos-ui-decorators';
Expand Down Expand Up @@ -147,14 +147,16 @@ export default class NodeVariantCreationDialog extends PureComponent {
>
<div className={style.modalContents}>
<div>
<I18n id="Neos.Neos:Main:content.dimension.createDialog.nodeTypeDoesNotExistInDimension" fallback="TODO" params={i18nParams}/>
{translate('Neos.Neos:Main:content.dimension.createDialog.nodeTypeDoesNotExistInDimension', '', i18nParams)}
</div>

<div>
<I18n id="Neos.Neos:Main:content.dimension.createDialog.createEmptyOrCopy" fallback="TODO" params={i18nParams}/>
{translate('Neos.Neos:Main:content.dimension.createDialog.createEmptyOrCopy', '', i18nParams)}
</div>
{numberOfParentNodesToBeCreated > 0 ?
<div><I18n id="Neos.Neos:Main:content.dimension.createDialog.existingAncestorDocuments" fallback="TODO" params={{numberOfNodesMissingInRootline: numberOfParentNodesToBeCreated}}/></div> : null
<div>
{translate('Neos.Neos:Main:content.dimension.createDialog.existingAncestorDocuments', '', {numberOfNodesMissingInRootline: numberOfParentNodesToBeCreated})}
</div> : null
}
</div>
</Dialog>
Expand Down

0 comments on commit 3586459

Please sign in to comment.