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

docs(layers): correct configuration requirements #2268

Merged
merged 1 commit into from
Jul 29, 2023
Merged

docs(layers): correct configuration requirements #2268

merged 1 commit into from
Jul 29, 2023

Conversation

dargmuesli
Copy link
Collaborator

πŸ”— Linked issue

n/a

❓ 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

In my testing it is required to also have locales set in the project which extends another. Also, the module does not have to be redefined in a project that extends another as the module is already defined in the project which is extended.

Beyond that, It would be interesting as well to have the documentation explain why it is necessary to repeat some of the configuration in the extending project! πŸ’‘ I'm wondering why it is like that and don't know :)

πŸ“ Checklist

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

In my testing it is required to also have `locales` set in the project which extends another. Also, the module does not have to be redefined in a project that extends another as the module is already defined in the project which is extended.
@nuxt-studio
Copy link

nuxt-studio bot commented Jul 28, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
i18n Edit on Studio β†—οΈŽ View Live Preview 1edd456

Copy link
Collaborator

@kazupon kazupon left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM!

@BobbieGoede
Do you have anything to add?

@kazupon kazupon requested a review from BobbieGoede July 28, 2023 15:59
@BobbieGoede
Copy link
Collaborator

Looks like that property is required, thanks for the PR!

Beyond that, It would be interesting as well to have the documentation explain why it is necessary to repeat some of the configuration in the extending project! πŸ’‘ I'm wondering why it is like that and don't know :)

Especially when using multiple layers, properties can get overwritten by each layer, so if a project is consuming a layer with lazy: true and a layer with lazy: false, depending on the order of extend the lazy property will be different. If lazy ends up being true then main the project is required to have langDir set.

Another reason for this is that files defined in locales are resolved relative to langDir, so we need a langDir in the main project to resolve locales defined in layers containing lazy loaded locales.

This behavior is a bit unintuitive and hard to explain well, ideally the main project extending i18n layers should not be required to configure anything. I'm actually working on a change to make this possible, so hopefully I can get that done soon!

@kazupon kazupon merged commit fbc7212 into nuxt-modules:next Jul 29, 2023
4 checks passed
@dargmuesli dargmuesli deleted the patch-1 branch July 29, 2023 20:01
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
In my testing it is required to also have `locales` set in the project which extends another. Also, the module does not have to be redefined in a project that extends another as the module is already defined in the project which is extended.
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.

3 participants