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

feat: configurable directory restructure #3054

Merged
merged 11 commits into from
Aug 8, 2024

Conversation

BobbieGoede
Copy link
Collaborator

@BobbieGoede BobbieGoede commented Aug 6, 2024

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 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)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This is still a work in progress!

This changes the way files are resolved and can be enabled by setting restructureDir: 'i18n'. This is no longer a breaking change as it is disabled by default allowing users a path to migrate before updating to v9, we will have to make sure to set the default values for v9 before release!

With restructureDir set to i18n the directory structure would look like so:

app/
server/
i18n/
  locales/
    en.json
    ja.json
  i18n.config.ts
  localeDetector.ts
nuxt.config.ts

And langDir will have a default value of locales, perhaps we may want to rename this to messages instead?

This kind of tackles #2983, as with this feature enabled we would resolve from <rootDir>/i18n/ for all i18n files.

📝 Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

@BobbieGoede BobbieGoede self-assigned this Aug 6, 2024
@kazupon
Copy link
Collaborator

kazupon commented Aug 7, 2024

Thanks!
Great works!
This looks good to me because this PR supports Nuxt4 and i18n-specific directories.

It might be good to be able to change the top directory name, as this might cause conflicts with users and 3rd vendors. restructure may accept string instead of boolean.
The option name restructureDir might be better.

@BobbieGoede BobbieGoede changed the title [Draft] feat!: i18n dir resolve feat: configurable directory restructure Aug 8, 2024
@BobbieGoede BobbieGoede marked this pull request as ready for review August 8, 2024 09:02
@BobbieGoede
Copy link
Collaborator Author

@kazupon
Thanks for the feedback! I have changed the option to restructureDir which accepts a string so users can configure the directory themselves.

We should set the default value in a separate PR as that would be a breaking change, but these changes should be fully compatible with v8, so users can opt into the restructure.

I've tried to update the v9 docs to already reflect the new default values, hopefully I haven't missed anything 😅

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.

Well done!
Thank you so much always 💚 !

@kazupon kazupon merged commit 08638d7 into nuxt-modules:main Aug 8, 2024
7 checks passed
BobbieGoede added a commit that referenced this pull request Aug 14, 2024
* feat: i18n dir resolve

* feat: i18n dir resolve

* test: add restructure test

* refactor: file resolution

* fix: layer option validation

* docs: describe breaking folder structure change

* fix: layer validation

* chore: update lockfile

* test: change fixture structure

* feat: `restructureDir` option

* docs: describe restructure and compatible option
antoinezanardi pushed a commit to antoinezanardi/werewolves-assistant-web-next that referenced this pull request Aug 16, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@nuxtjs/i18n](https://i18n.nuxtjs.org)
([source](https://github.com/nuxt-community/i18n-module)) | [`^8.3.3`
->
`^8.4.0`](https://renovatebot.com/diffs/npm/@nuxtjs%2fi18n/8.3.3/8.4.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@nuxtjs%2fi18n/8.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nuxtjs%2fi18n/8.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nuxtjs%2fi18n/8.3.3/8.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nuxtjs%2fi18n/8.3.3/8.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>nuxt-community/i18n-module (@&#8203;nuxtjs/i18n)</summary>

###
[`v8.4.0`](https://github.com/nuxt-modules/i18n/releases/tag/v8.4.0)

[Compare
Source](https://github.com/nuxt-community/i18n-module/compare/v8.3.3...v8.4.0)

#####    🚀 Features

- Configurable directory restructure  -  by
[@&#8203;BobbieGoede](https://github.com/BobbieGoede) in
[nuxt-modules/i18n#3054
[<samp>(c906a)</samp>](https://github.com/nuxt-modules/i18n/commit/c906a8d9)

#####    🐞 Bug Fixes

- Rename locale `iso` property to `language`  -  by
[@&#8203;BobbieGoede](https://github.com/BobbieGoede) in
[nuxt-modules/i18n#3055
[<samp>(df938)</samp>](https://github.com/nuxt-modules/i18n/commit/df938371)
- `strategy: 'no_prefix'` when using `differentDomains`  -  by
[@&#8203;BobbieGoede](https://github.com/BobbieGoede) in
[nuxt-modules/i18n#3061
[<samp>(53f16)</samp>](https://github.com/nuxt-modules/i18n/commit/53f16e6a)

#####     [View changes on
GitHub](https://github.com/nuxt-modules/i18n/compare/v8.3.3...v8.4.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job
log](https://developer.mend.io/github/antoinezanardi/werewolves-assistant-web-next).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AiLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

2 participants