Skip to content

Wrap hardcoded aria-label strings with __() for i18n support#2565

Merged
calebporzio merged 1 commit intomainfrom
josh/i18n-aria-labels
Apr 19, 2026
Merged

Wrap hardcoded aria-label strings with __() for i18n support#2565
calebporzio merged 1 commit intomainfrom
josh/i18n-aria-labels

Conversation

@joshhanley
Copy link
Copy Markdown
Member

The Scenario

Components with interactive elements like the modal close button and clearable input have hardcoded English aria-label attributes. Screen reader users in non-English locales hear English labels regardless of their application's language, making these components inaccessible to international users.

{{-- modal/index.blade.php --}}
<flux:button aria-label="Close modal">...</flux:button>

{{-- input/clearable.blade.php --}}
<flux:button aria-label="Clear input">...</flux:button>

The Problem

Several components use raw English strings in aria-label attributes instead of wrapping them with Laravel's __() translation helper. Other components in Flux already follow the correct pattern (e.g., sidebar/toggle.blade.php uses aria-label="{{ __('Toggle sidebar') }}"), so this is an inconsistency rather than a deliberate design decision.

The Solution

Wrap all hardcoded aria-label strings with __() so they can be translated via Laravel's JSON translation files:

{{-- Before --}}
aria-label="Close modal"

{{-- After --}}
aria-label="{{ __('Close modal') }}"

Strings added to the translatable set:

  • "Clear input"
  • "Close modal"

A corresponding PR for Flux Pro covers the remaining hardcoded strings there.

Fixes #2294

Wrap all hardcoded English `aria-label` attribute values with Laravel's
`__()` translation helper for i18n support. Several components already
used `__()` correctly but these were missed.
@calebporzio calebporzio merged commit 7357cb3 into main Apr 19, 2026
@calebporzio calebporzio deleted the josh/i18n-aria-labels branch April 19, 2026 13:57
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