i18n: make RichEditor text color labels translatable#19571
Merged
danharrin merged 7 commits intofilamentphp:4.xfrom Apr 3, 2026
Merged
i18n: make RichEditor text color labels translatable#19571danharrin merged 7 commits intofilamentphp:4.xfrom
danharrin merged 7 commits intofilamentphp:4.xfrom
Conversation
Use Laravel's translation system for TextColor default labels instead of hardcoded English names via Str::ucwords(). Add color name translations for EN and FR locales.
danharrin
requested changes
Mar 27, 2026
Member
danharrin
left a comment
There was a problem hiding this comment.
Please fix the merge conflicts
Please restore the previous behaviour of auto-generating an option label from the color name if the translation is missing from this list. You could fetch the entire list of options first in an array, and then check if the key exists before using the translation.
danharrin
approved these changes
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Currently,
TextColor::getDefaults()usesStr::ucwords($name)to generate color labels (e.g. "Red", "Slate"), which are hardcoded in English. This makes the color dropdown in the RichEditor unusable for non-English locales.This PR replaces the hardcoded labels with Laravel's
__()translation helper, allowing color names to be translated via language files. English and French translations are included. Other locales will fall back to the English translation by default.TextColor::getDefaults()now uses__('filament-forms::components.rich_editor.actions.text_color.modal.form.color.options.{name}')instead ofStr::ucwords($name)lang/en/components.php(26 colors)lang/fr/components.php(26 colors + fulltext_coloraction block)Visual changes
No visual changes for English users. French users will now see translated color names in the text color dropdown.
Functional changes
composer cscommand.