Skip to content

Commit 1f4b1de

Browse files
authored
Merge pull request #10368 from marmelab/fix-sort-button-translation
Fix SortButton default translation
2 parents 59e442e + e607fa5 commit 1f4b1de

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

packages/ra-ui-materialui/src/button/SortButton.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,16 @@ const SortButton = (props: SortButtonProps) => {
9191
setAnchorEl(null);
9292
};
9393

94+
const fieldLabel = translateLabel({
95+
resource,
96+
source: sort.field,
97+
});
9498
const buttonLabel = translate(label, {
95-
field: translateLabel({
96-
resource,
97-
source: sort.field,
98-
}),
99+
field: fieldLabel,
100+
field_lower_first:
101+
typeof fieldLabel === 'string'
102+
? fieldLabel.charAt(0).toLowerCase() + fieldLabel.slice(1)
103+
: undefined,
99104
order: translate(`ra.sort.${sort.order}`),
100105
_: label,
101106
});

0 commit comments

Comments
 (0)