question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing key id, throws error in i18n.t('mykeyId')`MyDefault`

See original GitHub issue
i18n.t('ui.video')`Video`

throws

at zip (core.development.js:145)
    at I18n.t (core.development.js:155)
    at ProxyComponent.renderModal (EditForm.js:50)

ui.video is missing from the translations. But that shouldn’t matter. This should never throw an error, a warning maybe, but not a hard error

context: Versions: “@lingui/babel-preset-react”: “2.0.7”, “@lingui/cli”: “2.0.7”, “@lingui/react”: “2.0.7”,

class EditForm extends React.PureComponent {
  [...]
  renderModal() {
    const { i18n } = this.props;
    const { modal, videoId } = this.state;

    return (
      <MobileFullSceenModal
        title={i18n.t('ui.video')`Video`}
        open={modal}
        onClose={this.handleCloseModal}
      >
        <VideoPlayer videoId={videoId} />
      </MobileFullSceenModal>
    );
  }
  render() {
    const { id, item } = this.props;
    return (
      <Form
        formName={config.formName}
        render={({ submitting, validating, handleSubmit }) => (
          <form onSubmit={handleSubmit}>
            {this.renderModal()}
                    <Field
                      id="videoId"
                      name="videoId"
                      component={TextInput}
                      label="VideoId"
                      format={extractYouTubeId}
                      parse={extractYouTubeId}
                    />
                    <SubmitButton
                      submitting={submitting || validating}
                      submitSuccess={submitSucceeded}
                    >
                      <Trans id="ui.submit">Submit</Trans>
                    </SubmitButton>

          </form>
        )}
      />
    );
  }
}

export default connect(null, { listVideos })(withI18n()(EditForm));

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mschipperheyncommented, Jul 23, 2018

I think this had to do with the order of the babel entry. It works for me now

0reactions
tricoder42commented, Jul 22, 2018

@mschipperheyn Could you please try to update to latest versions? I’ve just tried your example and it works.

If it won’t help, also try to remove @lingui/babel-preset-react preset and instead add both lingui plugins (@lingui/babel-plugin-transform-js, @lingui/babel-plugin-transform-react) to the top of your plugins.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Untitled
Remove key from car or block signal from fob to where vehicle tells you the key is not detected! 5. Select Settings >...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found