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

V4 feedback: Change createMessagesDeclaration to take an array so monorepos can be supported #1699

Closed
felix-quotez opened this issue Feb 5, 2025 · 1 comment
Labels
enhancement New feature or request Stale unconfirmed Needs triage.

Comments

@felix-quotez
Copy link
Contributor

Is your feature request related to a problem? Please describe.

I love the type-safety that "createMessagesDeclaration" enables(https://v4.next-intl.dev/docs/workflows/typescript#messages-arguments)!

I have multiple packages in a monorepo (two Next.js apps and some shared UI components). The UI package has shared translation messages. When running either of the two Next.js apps, I would like to be able to add the messages of the UI package to createMessagesDeclaration so that an additional .d.ts file will be created.

Describe the solution you'd like

Suggestion:

const withNextIntl = createNextIntlPlugin({
  experimental: {
    createMessagesDeclaration: ['./messages/en.json', '../../packages/ui/messages/en.json'],
  },
})

Describe alternatives you've considered

None yet. (For what it's worth, note that my shared UI package is not bundled or preprocessed in any way because I want to have get hot module reloading. So the two Next.js apps are using the shared code directly.)

@felix-quotez felix-quotez added enhancement New feature or request unconfirmed Needs triage. labels Feb 5, 2025
amannn added a commit that referenced this issue Feb 5, 2025
…epo support (#1700)

Resolves: #1699

This change renames "createMessagesDeclaration" to
"createMessagesDeclarations" and changes the type to an array. Each
entry of the array will be used to create message declaration files.
Supporting multiple message files helps to use next-intl in monorepo
setups.

Since v4 is in beta, I renamed the property and removed support for a
single string. To me, clean types lead to cleaner code. If compatibility
is a more of a concern during the beta phase, I could not change the
property name and keep the support for single strings. Please let me
know.

---------

Co-authored-by: Jan Amann <jan@amann.work>
Copy link

github-actions bot commented Mar 8, 2025

This issue has been automatically closed because there was no recent activity and it was marked as unconfirmed. Note that issues are regularly checked and if they remain in unconfirmed state, they might miss information required to be actionable or are potentially out-of-scope. If you'd like to discuss this topic further, feel free to open a discussion instead.

@github-actions github-actions bot added the Stale label Mar 8, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Stale unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

1 participant