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

CLI for extraction of messages #18

Open
ryan-codingintrigue opened this issue May 4, 2020 · 0 comments
Open

CLI for extraction of messages #18

ryan-codingintrigue opened this issue May 4, 2020 · 0 comments

Comments

@ryan-codingintrigue
Copy link

I'm trying to migrate a project from React to lit-html and replacing any instances of react-intl with lit-translate. The one thing I miss is the FormatJS CLI

It would be nice to be able to define messages in the same way, e.g.

import { defineMessages, get } from "@appnest/lit-translate";
import { html } from "lit-html";

const messages = defineMessages({
  foo: {
    id: 'foo',
    defaultMessage: 'foo',
    description: 'bar',
  },
});

export default () => html`
    <div>${get(messages.foo)}</div>
`;

And have a @appnest/lit-translate-cli which could extract messages in the same way:

formatjs extract [options] [files...]

I think this approach has two advantages:

  1. Tools can be used to ensure localizations are in-sync and not missed
  2. It enforces linking localizations to the components in which they are used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant