Skip to content

feat(Shortcut): add internationalization (i18n) support#910

Merged
nicolethoen merged 1 commit intopatternfly:mainfrom
sg00dwin:shortcut-i18n
Apr 8, 2026
Merged

feat(Shortcut): add internationalization (i18n) support#910
nicolethoen merged 1 commit intopatternfly:mainfrom
sg00dwin:shortcut-i18n

Conversation

@sg00dwin
Copy link
Copy Markdown
Contributor

Summary

  • Adds optional props for customizing all user-facing mouse action strings in Shortcut
  • Maintains full backward compatibility with English defaults

Details

Applications using Shortcut that need to support non-English languages or custom terminology can now provide custom labels for all mouse action strings.

New Props

All props are optional with English defaults:

  • hoverLabel: Custom label for "Hover" action (default: "Hover")
  • clickLabel: Custom label for "Click" action (default: "Click")
  • rightClickLabel: Custom label for "Right click" action (default: "Right click")
  • dragLabel: Custom label for "Drag" action (default: "Drag")
  • dragAndDropLabel: Custom label for "Drag + Drop" action (default: "Drag + Drop")

Example Usage

import { useTranslation } from 'react-i18next';

const MyComponent = () => {
  const { t } = useTranslation();

  return (
    <Shortcut
      keys={['cmd', 'shift']}
      click
      clickLabel={t('shortcut.click')}
      hover
      hoverLabel={t('shortcut.hover')}
      description="Save document"
    />
  );
};

Test plan

  • All existing tests pass (backward compatibility maintained)
  • Added new test with French labels to verify i18n functionality
  • Build completes successfully
  • No breaking changes - existing usage works exactly as before

Assisted by Claude Code

@patternfly-build
Copy link
Copy Markdown

patternfly-build commented Mar 31, 2026

@sg00dwin
Copy link
Copy Markdown
Contributor Author

sg00dwin commented Apr 3, 2026

@nicolethoen PTAL thanks!

@nicolethoen nicolethoen merged commit a46b56b into patternfly:main Apr 8, 2026
6 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

🎉 This PR is included in version 6.4.0-prerelease.18 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sg00dwin sg00dwin deleted the shortcut-i18n branch April 9, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants