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

refactor: pass generated options through runtimeConfig #2828

Conversation

BobbieGoede
Copy link
Collaborator

@BobbieGoede BobbieGoede commented Mar 5, 2024

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Replaces #2734

I would still like to improve the type in ModulePublicRuntimeConfig so users know which values cannot be configured using runtimeConfig, for example those used during route generation, should I mark these @internal using JSDocs?

By using runtimeConfig to pass the generated options we can reduce the complexity of our generated options templates (#build/i18n.options.mjs and #internal/i18n/options.mjs) and will make it easier for us to add runtimeConfig support for options used exclusively during runtime (detectBrowserLanguage for example).

I had to add configLocales to the runtime config as locales was already used for runtime domain support, we should probably merge these configurations for v9.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@BobbieGoede BobbieGoede requested a review from kazupon March 5, 2024 19:30
@BobbieGoede BobbieGoede self-assigned this Mar 5, 2024
@kazupon
Copy link
Collaborator

kazupon commented Mar 6, 2024

I would still like to improve the type in ModulePublicRuntimeConfig so users know which values cannot be configured using runtimeConfig, for example those used during route generation, should I mark these @internal using JSDocs?

Yes!
We should mark as @internal and summary note for developer.

skipSettingLocaleOnNavigate: options.skipSettingLocaleOnNavigate,
differentDomains: options.differentDomains,
trailingSlash: options.trailingSlash,
configLocales: options.locales,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm πŸ€”
I would also prefer locales instead of configLocales if possible.
It seems that locales have been introduced by this PR.
#2446

In v9, we should also be organized runtimeConfig.
locales should be domainLocales and configLocales should be locales.

@BobbieGoede
What do you think?

Copy link
Collaborator Author

@BobbieGoede BobbieGoede Mar 7, 2024

Choose a reason for hiding this comment

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

In v9, we should also be organized runtimeConfig.
locales should be domainLocales and configLocales should be locales.

Agreed, that sounds good! I have added a reference in the roadmap discussion #2814

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks! Okay, I'll merge this PR!

@kazupon kazupon merged commit b001647 into nuxt-modules:main Mar 7, 2024
7 checks passed
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
@kazupon kazupon mentioned this pull request Jun 28, 2024
12 tasks
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

Successfully merging this pull request may close these issues.

None yet

2 participants