laravel / laravel/nova-issues

Badge field translation issue

Open
#6,962 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
557
Forks
33
PR merge metrics
No merged PRs in 30d

Description

- Laravel Version: 10.50.0
- Nova Version: 5.7.6
- PHP Version: 8.3.30
- Database Driver & Version: MySQL 8.1.0
- Operating System and Version: Windows 11 Education 10.0.26100 + docker wsl ubuntu
- Browser type and version: Edge
- Reproduction Repository: https://github.com/###/###

### Description:
Translations for the Badge field labels work correctly on the Index page, but they do not work on the Preview or Detail pages.

This issue seems specific to the Badge field, which makes me suspect a serialization issue in **Nova 5**, since the same implementation was working correctly in **Nova 4**.

### Detailed steps to reproduce the issue on a fresh Nova installation:
I have a Badge that I simplified the label method here for simple reading:
`Badge::make('État', 'status')
->map(Status::getCssClasses())
->labels([
'in_progress' => __('imports.statuses.in_progress'),
'completed' => __('imports.statuses.completed'),
'completed_with_errors' => __('imports.statuses.completed_with_errors'),
'failed' => __('imports.statuses.failed'),
'duplicated' => __('imports.statuses.duplicated'),
])
->withIcons()
->showOnPreview(),
`

with imports.php
`'statuses' => [
'in_progress' => 'En cours',
'completed' => 'Complété',
'completed_with_errors' => 'Complété avec des erreurs',
'failed' => 'Échoué',
'duplicated' => 'Dupliqué',
],
`

### Observed Behavior

Index page: translations are displayed correctly
Preview page: translation keys are shown instead of translated labels
Detail page: translation keys are shown instead of translated labels

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Badge field definition shown in the issue on a fresh Nova installation and compare its rendering on the Index, Preview, and Detail pages. Trace how the labels are passed to each page; done means translated labels appear consistently on Preview and Detail instead of translation keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
frontend, localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.