-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Canvas] Converting workpad header components to typescript and adding i18n #45274
[Canvas] Converting workpad header components to typescript and adding i18n #45274
Conversation
Pinging @elastic/kibana-canvas |
💚 Build Succeeded |
💚 Build Succeeded |
💚 Build Succeeded |
0c2c7b1
to
cf2f081
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of things to confirm/tweak, so I'm just going to comment for now... hit me up when everything's addressed and I'll review again. I'd love to see @bmcconaghy or someone from #i18n to take a look at the plurals and keys.
@@ -18,20 +19,20 @@ export const ComponentStrings = { | |||
}), | |||
}, | |||
Asset: { | |||
getCopyAssetTooltipText: () => | |||
i18n.translate('xpack.canvas.asset.copyAssetTooltipText', { | |||
getCopyAssetTooltip: () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these strings have already been translated, this will blow up in i18n
parsing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true but I only merged in the first version of these i18n strings yesterday. Do they translate that quickly? #44943
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We extract the labels a few weeks before FF and at FF so they are not translated yet. Additionally the CI should fail if the translation files need a fix. Which can be fixed in the PR by running node/scripts i18n_check.js --fix
return ( | ||
<EuiFlexGroup direction="column" justifyContent="spaceBetween"> | ||
<EuiFlexItem grow={false}> | ||
<EuiFlexGroup alignItems="center" justifyContent="spaceAround" gutterSize="xs"> | ||
<EuiFlexItem> | ||
<EuiDescriptionList textStyle="reverse"> | ||
<EuiDescriptionListTitle>Refresh elements</EuiDescriptionListTitle> | ||
<EuiDescriptionListTitle>{strings.getRefreshListTitle()}</EuiDescriptionListTitle> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look properly formatted. Are you sure your IDE is configured properly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I see the formatting issue? The linter seems happy with it
...y/plugins/canvas/public/components/workpad_header/control_settings/auto_refresh_controls.tsx
Outdated
Show resolved
Hide resolved
...legacy/plugins/canvas/public/components/workpad_header/control_settings/control_settings.tsx
Show resolved
Hide resolved
.../legacy/plugins/canvas/public/components/workpad_header/control_settings/custom_interval.tsx
Outdated
Show resolved
Hide resolved
@@ -24,8 +25,14 @@ export const DisabledPanel = ({ onCopy }: Props) => ( | |||
<div className="canvasWorkpadExport__panelContent"> | |||
<EuiText size="s"> | |||
<p> | |||
Export to PDF is disabled. You must configure reporting to use the Chromium browser. Add | |||
this to your <EuiCode>kibana.yml</EuiCode> file. | |||
<FormattedMessage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This is syntactic sugar around i18n
, so we should probably extract out to a dictionary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was curious about how to handle this case since the string needs to pass in a component with the <EuiCode>kibana.yml</EuiCode>
block. My thought was maybe we don't want to import / use components in the i18n string dictionaries but I can always make that happen. I suppose alternatively I can always pass the <EuiCode>kibana.yml</EuiCode>
to the string function. Any preference?
💔 Build Failed |
cf2f081
to
dc65760
Compare
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translations LGTM. Wrote a couple of comments
@@ -18,20 +19,20 @@ export const ComponentStrings = { | |||
}), | |||
}, | |||
Asset: { | |||
getCopyAssetTooltipText: () => | |||
i18n.translate('xpack.canvas.asset.copyAssetTooltipText', { | |||
getCopyAssetTooltip: () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We extract the labels a few weeks before FF and at FF so they are not translated yet. Additionally the CI should fail if the translation files need a fix. Which can be fixed in the PR by running node/scripts i18n_check.js --fix
time: { | ||
getSecondsText: (seconds: number) => | ||
i18n.translate('xpack.canvas.units.time.seconds', { | ||
defaultMessage: '{seconds} {seconds, plural, one {second} other {seconds}}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can write this instead
{seconds, plural, one {# second} other {# seconds}
the # here will return the value of seconds
;
💔 Build Failed |
💚 Build Succeeded |
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…g i18n (elastic#45274) * Converting workpad header components to typescript and adding i18n * i18n for custom interval * Refactor of i18n ids and better time text * Fixing help example * Refactor of some naming * More string refactor and finishing workpad export * Addressing some PR feedback * Changing plural format * Quick fix * Zoom controls * Fixing id
…g i18n (#45274) (#45927) * Converting workpad header components to typescript and adding i18n * i18n for custom interval * Refactor of i18n ids and better time text * Fixing help example * Refactor of some naming * More string refactor and finishing workpad export * Addressing some PR feedback * Changing plural format * Quick fix * Zoom controls * Fixing id
* master: (33 commits) [easy] Exclude __examples__ from coverage (elastic#45556) [DOCS] Update CCR links (elastic#44012) Use unique junit report filenames again (elastic#45897) [ftr/savedObjects] add simple saved object api client to ftr s… (elastic#45856) New visualization editor Lens (elastic#36437) Sort using unix timestamp value (elastic#43162) [APM] Use POST instead of implicit GET (elastic#45903) [Canvas] Converting workpad header components to typescript and adding i18n (elastic#45274) skip flaky test (elastic#45884) set IS_PIPELINE_JOB in intake jobs (elastic#45850) [Uptime] Fix/issue 48 integration popup closes after refresh (elastic#45759) [Logs UI] Support zoom by brushing in the log rate chart (elastic#45879) [DOCS] Changes name to host (elastic#45798) [ML] Add population job wizard test (elastic#45765) [skip-ci][Maps][File upload] Geojson indexing and styling docs (elastic#41394) remove setTimeoue for state change (elastic#45853) [Graph] Restructure folders and add readme (elastic#45782) [ML] Enhance job id error message (elastic#45349) [SIEM] Do not update state component when they did unmount (elastic#45847) [i18n] sync from 7.4 latest translations (elastic#45823) ...
Summary
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] This was checked for cross-browser compatibility, including a check against IE11- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] Documentation was added for features that require explanation or tutorials- [ ] Unit or functional tests were updated or added to match the most common scenarios- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers