Skip to content
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

Merged

Conversation

poffdeluxe
Copy link
Contributor

Summary

  • Converting a few more of the workpad header components to typescript and adding i18n.
  • Setup new "units" i18n file for unit labels

Checklist

Use strikethroughs to 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 accessibility

For maintainers

@poffdeluxe poffdeluxe added review Project:i18n Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:small Small Level of Effort v8.0.0 release_note:skip Skip the PR/issue when compiling release notes impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. v7.5.0 labels Sep 10, 2019
@poffdeluxe poffdeluxe requested a review from a team as a code owner September 10, 2019 15:34
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-canvas

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@poffdeluxe poffdeluxe force-pushed the i18n-canvas-workpad-header-controls branch from 0c2c7b1 to cf2f081 Compare September 12, 2019 15:43
Copy link
Contributor

@clintandrewhall clintandrewhall left a 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.

x-pack/legacy/plugins/canvas/i18n/components.ts Outdated Show resolved Hide resolved
@@ -18,20 +19,20 @@ export const ComponentStrings = {
}),
},
Asset: {
getCopyAssetTooltipText: () =>
i18n.translate('xpack.canvas.asset.copyAssetTooltipText', {
getCopyAssetTooltip: () =>
Copy link
Contributor

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.

Copy link
Contributor Author

@poffdeluxe poffdeluxe Sep 12, 2019

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

Copy link
Member

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

x-pack/legacy/plugins/canvas/i18n/components.ts Outdated Show resolved Hide resolved
x-pack/legacy/plugins/canvas/i18n/units.ts Outdated Show resolved Hide resolved
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>
Copy link
Contributor

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?

Copy link
Contributor Author

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

@@ -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
Copy link
Contributor

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.

Copy link
Contributor Author

@poffdeluxe poffdeluxe Sep 12, 2019

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?

@elasticmachine
Copy link
Contributor

💔 Build Failed

@poffdeluxe poffdeluxe force-pushed the i18n-canvas-workpad-header-controls branch from cf2f081 to dc65760 Compare September 12, 2019 22:25
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@Bamieh Bamieh left a 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: () =>
Copy link
Member

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}}',
Copy link
Member

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;

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@poffdeluxe poffdeluxe merged commit 54359e7 into elastic:master Sep 17, 2019
@poffdeluxe poffdeluxe deleted the i18n-canvas-workpad-header-controls branch September 17, 2019 18:13
poffdeluxe added a commit to poffdeluxe/kibana that referenced this pull request Sep 17, 2019
…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
poffdeluxe added a commit that referenced this pull request Sep 17, 2019
…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
rylnd added a commit to rylnd/kibana that referenced this pull request Sep 17, 2019
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:small Small Level of Effort Project:i18n release_note:skip Skip the PR/issue when compiling release notes review Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.5.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants