Fixed: Translations for columns
This commit is contained in:
parent
622f820da9
commit
6d53d2a153
|
@ -43,7 +43,7 @@ class Icon extends PureComponent {
|
|||
return (
|
||||
<span
|
||||
className={containerClassName}
|
||||
title={title}
|
||||
title={typeof title === 'function' ? title() : title}
|
||||
>
|
||||
{icon}
|
||||
</span>
|
||||
|
@ -60,7 +60,7 @@ Icon.propTypes = {
|
|||
name: PropTypes.object.isRequired,
|
||||
kind: PropTypes.string.isRequired,
|
||||
size: PropTypes.number.isRequired,
|
||||
title: PropTypes.string,
|
||||
title: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
darken: PropTypes.bool.isRequired,
|
||||
isSpinning: PropTypes.bool.isRequired,
|
||||
fixedWidth: PropTypes.bool.isRequired
|
||||
|
|
|
@ -119,9 +119,8 @@ export const defaultState = {
|
|||
},
|
||||
label: React.createElement(Icon, {
|
||||
name: icons.SCORE,
|
||||
get title() {
|
||||
return translate('CustomFormatScore');
|
||||
}
|
||||
title: () => translate('CustomFormatScore')
|
||||
|
||||
}),
|
||||
isVisible: false
|
||||
},
|
||||
|
|
|
@ -36,10 +36,17 @@ function mergeColumns(path, initialState, persistedState, computedState) {
|
|||
const column = initialColumns.find((i) => i.name === persistedColumn.name);
|
||||
|
||||
if (column) {
|
||||
columns.push({
|
||||
...column,
|
||||
isVisible: persistedColumn.isVisible
|
||||
});
|
||||
const newColumn = {};
|
||||
|
||||
// We can't use a spread operator or Object.assign to clone the column
|
||||
// or any accessors are lost and can break translations.
|
||||
for (const prop of Object.keys(column)) {
|
||||
Object.defineProperty(newColumn, prop, Object.getOwnPropertyDescriptor(column, prop));
|
||||
}
|
||||
|
||||
newColumn.isVisible = persistedColumn.isVisible;
|
||||
|
||||
columns.push(newColumn);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue