fix(NotificationDrawer): add Translation capability - #339
Conversation
3b6dcbf to
13ab649
Compare
| > | ||
| <Button bsStyle="link" onClick={() => onMarkPanelAsRead(panelkey)}> | ||
| Mark All Read | ||
| {translations.readAll} |
There was a problem hiding this comment.
@gilad215 just curious what happens when someone accidentally replaces the entire translations object instead of merging or Object.assigning it, or is that even a concern? If we are concerned, could a possible solution involve placing checks for the translation object property, or maybe they're, or it is, required?
There was a problem hiding this comment.
translations is not a required prop.
I don't see how someone can accidentally override the default object without actually writing
translations={...}
If someone makes mistakes, thats their responsibility to fix it, because the object's properties are documented in the storybook
There was a problem hiding this comment.
For clarity, if a consumer only handles these properties ...
translations: {
emptyState: 'Lorem Ipsum Available',
readAll: 'Lorem Ipsum Read',
clearAll: 'Lorem Ipsum Clear'
}
What's the expected outcome?
There was a problem hiding this comment.
The title will be empty, Do you think consumers will want to translate only some of the properties? seems weird to me. If they do it by mistake i'm pretty sure they will understand why. Also, having a prop for each component doesn't look like a solution either, this is a very rare case..
There was a problem hiding this comment.
Thinking it's always good to acknowledge limitations @gilad215
There are consumers and use cases that aren't always obvious. Your implementation is direct and works, nothing wrong with that. We can always re-approach at a later time if it pops back.
Alternatives possibly could have included something like using objectOf or shape, but that may have brought with it other outcomes
13ab649 to
fd12b48
Compare
jeff-phillips-18
left a comment
There was a problem hiding this comment.
I'd say this is OK as is, though I agree with @cdcabrera that we may want to revisit to define the required strings so they can be well known (shown in storybook) and/or handle defaulting those which are not set.
fd12b48 to
8936f35
Compare
|
8936f35 to
1a928be
Compare
1a928be to
5fb3c50
Compare
affects: patternfly-react
5fb3c50 to
05f0bd9
Compare
cdcabrera
left a comment
There was a problem hiding this comment.
Awesome! looks good @gilad215
affects: patternfly-react
What:
Added ability to add Translations to the Drawer. Components that can be translated:
Panels and Notifications were already translatable.