mirror of
https://github.com/lidarr/Lidarr
synced 2025-03-15 08:19:05 +00:00
Fixed translations for columns
(cherry picked from commit 6d53d2a153a98070c42d0619c15902b6bd5dfab4) Closes #3897
This commit is contained in:
parent
6c9ee67e51
commit
7406e0e3b7
6 changed files with 17 additions and 10 deletions
|
@ -41,7 +41,7 @@ class Icon extends PureComponent {
|
|||
return (
|
||||
<span
|
||||
className={containerClassName}
|
||||
title={title}
|
||||
title={typeof title === 'function' ? title() : title}
|
||||
>
|
||||
{icon}
|
||||
</span>
|
||||
|
@ -58,7 +58,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]),
|
||||
isSpinning: PropTypes.bool.isRequired,
|
||||
fixedWidth: PropTypes.bool.isRequired
|
||||
};
|
||||
|
|
|
@ -74,7 +74,7 @@ const columns = [
|
|||
name: 'customFormats',
|
||||
label: React.createElement(Icon, {
|
||||
name: icons.INTERACTIVE,
|
||||
title: translate('CustomFormat')
|
||||
title: () => translate('CustomFormat')
|
||||
}),
|
||||
isSortable: true,
|
||||
isVisible: true
|
||||
|
|
|
@ -60,7 +60,7 @@ const columns = [
|
|||
name: 'customFormatScore',
|
||||
label: React.createElement(Icon, {
|
||||
name: icons.SCORE,
|
||||
title: translate('CustomFormatScore')
|
||||
title: () => translate('CustomFormatScore')
|
||||
}),
|
||||
isSortable: true,
|
||||
isVisible: true
|
||||
|
|
|
@ -100,7 +100,7 @@ export const defaultState = {
|
|||
columnLabel: translate('CustomFormatScore'),
|
||||
label: React.createElement(Icon, {
|
||||
name: icons.SCORE,
|
||||
title: translate('CustomFormatScore')
|
||||
title: () => translate('CustomFormatScore')
|
||||
}),
|
||||
isVisible: false
|
||||
},
|
||||
|
|
|
@ -68,7 +68,7 @@ export const defaultState = {
|
|||
columnLabel: translate('CustomFormatScore'),
|
||||
label: React.createElement(Icon, {
|
||||
name: icons.SCORE,
|
||||
title: 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…
Add table
Reference in a new issue