Skip to content

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

Open
sg00dwin wants to merge 1 commit intopatternfly:mainfrom
sg00dwin:shortcut-i18n
Open

feat(Shortcut): add internationalization (i18n) support#910
sg00dwin wants to merge 1 commit intopatternfly:mainfrom
sg00dwin:shortcut-i18n

Conversation

@sg00dwin
Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants