mirror of
https://github.com/mattermost/focalboard.git
synced 2025-03-17 20:37:54 +02:00
i18n hardcoded strings from boardPage's UndoRedoHotKeys.tsx (#3483)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
parent
1e1854a5dd
commit
6350263f68
@ -250,6 +250,12 @@
|
||||
"URLProperty.copiedLink": "Copied!",
|
||||
"URLProperty.copy": "Copy",
|
||||
"URLProperty.edit": "Edit",
|
||||
"UndoRedoHotKeys.canRedo": "Redo",
|
||||
"UndoRedoHotKeys.canRedo-with-description": "Redo {description}",
|
||||
"UndoRedoHotKeys.canUndo": "Undo",
|
||||
"UndoRedoHotKeys.canUndo-with-description": "Undo {description}",
|
||||
"UndoRedoHotKeys.cannotRedo": "Nothing to Redo",
|
||||
"UndoRedoHotKeys.cannotUndo": "Nothing to Undo",
|
||||
"ValueSelector.noOptions": "No options. Start typing to add the first one!",
|
||||
"ValueSelector.valueSelector": "Value selector",
|
||||
"ValueSelectorLabel.openMenu": "Open menu",
|
||||
|
@ -1,25 +1,36 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import {useHotkeys} from 'react-hotkeys-hook'
|
||||
import {useIntl} from 'react-intl'
|
||||
|
||||
import {sendFlashMessage} from '../../components/flashMessages'
|
||||
import mutator from '../../mutator'
|
||||
import {Utils} from '../../utils'
|
||||
|
||||
const UndoRedoHotKeys = (): null => {
|
||||
const intl = useIntl()
|
||||
|
||||
useHotkeys('ctrl+z,cmd+z', () => {
|
||||
Utils.log('Undo')
|
||||
if (mutator.canUndo) {
|
||||
const description = mutator.undoDescription
|
||||
mutator.undo().then(() => {
|
||||
if (description) {
|
||||
sendFlashMessage({content: `Undo ${description}`, severity: 'low'})
|
||||
sendFlashMessage({
|
||||
content: intl.formatMessage({id: 'UndoRedoHotKeys.canUndo-with-description', defaultMessage: 'Undo {description}'}, {description: description}),
|
||||
severity: 'low'
|
||||
})
|
||||
} else {
|
||||
sendFlashMessage({content: 'Undo', severity: 'low'})
|
||||
sendFlashMessage({
|
||||
content: intl.formatMessage({id: 'UndoRedoHotKeys.canUndo', defaultMessage: 'Undo'}),
|
||||
severity: 'low'})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
sendFlashMessage({content: 'Nothing to Undo', severity: 'low'})
|
||||
sendFlashMessage({
|
||||
content: intl.formatMessage({id: 'UndoRedoHotKeys.cannotUndo', defaultMessage: 'Nothing to Undo'}),
|
||||
severity: 'low'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@ -29,13 +40,22 @@ const UndoRedoHotKeys = (): null => {
|
||||
const description = mutator.redoDescription
|
||||
mutator.redo().then(() => {
|
||||
if (description) {
|
||||
sendFlashMessage({content: `Redo ${description}`, severity: 'low'})
|
||||
sendFlashMessage({
|
||||
content: intl.formatMessage({id: 'UndoRedoHotKeys.canRedo-with-description', defaultMessage: 'Redo {description}'}, {description: description}),
|
||||
severity: 'low'
|
||||
})
|
||||
} else {
|
||||
sendFlashMessage({content: 'Redu', severity: 'low'})
|
||||
sendFlashMessage({
|
||||
content: intl.formatMessage({id: 'UndoRedoHotKeys.canRedo', defaultMessage: 'Redo'}),
|
||||
severity: 'low'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
sendFlashMessage({content: 'Nothing to Redo', severity: 'low'})
|
||||
sendFlashMessage({
|
||||
content: intl.formatMessage({id: 'UndoRedoHotKeys.cannotRedo', defaultMessage: 'Nothing to Redo'}),
|
||||
severity: 'low'
|
||||
})
|
||||
}
|
||||
})
|
||||
return null
|
||||
|
Loading…
x
Reference in New Issue
Block a user