While reviewing a PR making use of EuiI18n, I came across this fairly boilerplate code making use of the render method to get the translated text:
<EuiI18n
token="euiContext.openMenu"
default="Open menu"
>
{(openMenu: string) => (
<EuiHeaderLogo
iconType="apps"
aria-label={openMenu}
onClick={() => toggleOpen()}
/>
)}
</EuiI18n>
It got me wondering, can we not generically allow HTML attributes to be specified as EuiI18n | string parameters, thus bridging the gap and enabling simpler usage of translation?
<EuiHeaderLogo
iconType="apps"
aria-label={
<EuiI18n
token="euiContext.openMenu"
default="Open menu"
/>
}
onClick={() => toggleOpen()}
/>
Then could we take this a step further and push that into all EUI components, like EuiNavDrawerGroup's labels.
While reviewing a PR making use of
EuiI18n, I came across this fairly boilerplate code making use of the render method to get the translated text:It got me wondering, can we not generically allow HTML attributes to be specified as
EuiI18n | stringparameters, thus bridging the gap and enabling simpler usage of translation?Then could we take this a step further and push that into all EUI components, like
EuiNavDrawerGroup'slabels.