mvc: translate grid view labels - #10537
Closed
Opnwall wants to merge 1 commit into
Closed
Conversation
| } elseif ($key == 'sequence') { | ||
| $this_sequence = (string)$item; | ||
| } elseif ($key == 'label') { | ||
| $record[$key] = gettext((string)$item); |
Member
There was a problem hiding this comment.
Suggested change
| $record[$key] = gettext((string)$item); | |
| if (strlen($text)) { | |
| $record[$key] = gettext((string)$item); | |
| } |
good catch, these should be translated indeed, best also check for strsize for consistency with the dialog.
Member
|
merged in 21ccf46 |
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.
Summary
grid_viewRoot cause
getFormGrid()translates a field's regularlabel, but agrid_view/labelis copied into the grid record afterwards without passing throughgettext(). This overwrites the translated field label with its untranslated grid-specific label.For example, the Source NAT grid uses grid-specific labels such as
Source,Port, andDestination, so those column headers remain in English even when the active locale contains translations for them.Impact
Grid-specific column labels now use the active locale consistently with regular field labels.
Validation
php -l src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.phpgit diff --check