mirror of
https://github.com/mattermost/focalboard.git
synced 2025-03-20 20:45:00 +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.copiedLink": "Copied!",
|
||||||
"URLProperty.copy": "Copy",
|
"URLProperty.copy": "Copy",
|
||||||
"URLProperty.edit": "Edit",
|
"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.noOptions": "No options. Start typing to add the first one!",
|
||||||
"ValueSelector.valueSelector": "Value selector",
|
"ValueSelector.valueSelector": "Value selector",
|
||||||
"ValueSelectorLabel.openMenu": "Open menu",
|
"ValueSelectorLabel.openMenu": "Open menu",
|
||||||
|
@ -1,25 +1,36 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
import {useHotkeys} from 'react-hotkeys-hook'
|
import {useHotkeys} from 'react-hotkeys-hook'
|
||||||
|
import {useIntl} from 'react-intl'
|
||||||
|
|
||||||
import {sendFlashMessage} from '../../components/flashMessages'
|
import {sendFlashMessage} from '../../components/flashMessages'
|
||||||
import mutator from '../../mutator'
|
import mutator from '../../mutator'
|
||||||
import {Utils} from '../../utils'
|
import {Utils} from '../../utils'
|
||||||
|
|
||||||
const UndoRedoHotKeys = (): null => {
|
const UndoRedoHotKeys = (): null => {
|
||||||
|
const intl = useIntl()
|
||||||
|
|
||||||
useHotkeys('ctrl+z,cmd+z', () => {
|
useHotkeys('ctrl+z,cmd+z', () => {
|
||||||
Utils.log('Undo')
|
Utils.log('Undo')
|
||||||
if (mutator.canUndo) {
|
if (mutator.canUndo) {
|
||||||
const description = mutator.undoDescription
|
const description = mutator.undoDescription
|
||||||
mutator.undo().then(() => {
|
mutator.undo().then(() => {
|
||||||
if (description) {
|
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 {
|
} else {
|
||||||
sendFlashMessage({content: 'Undo', severity: 'low'})
|
sendFlashMessage({
|
||||||
|
content: intl.formatMessage({id: 'UndoRedoHotKeys.canUndo', defaultMessage: 'Undo'}),
|
||||||
|
severity: 'low'})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} 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
|
const description = mutator.redoDescription
|
||||||
mutator.redo().then(() => {
|
mutator.redo().then(() => {
|
||||||
if (description) {
|
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 {
|
} else {
|
||||||
sendFlashMessage({content: 'Redu', severity: 'low'})
|
sendFlashMessage({
|
||||||
|
content: intl.formatMessage({id: 'UndoRedoHotKeys.canRedo', defaultMessage: 'Redo'}),
|
||||||
|
severity: 'low'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
sendFlashMessage({content: 'Nothing to Redo', severity: 'low'})
|
sendFlashMessage({
|
||||||
|
content: intl.formatMessage({id: 'UndoRedoHotKeys.cannotRedo', defaultMessage: 'Nothing to Redo'}),
|
||||||
|
severity: 'low'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return null
|
return null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user