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: support server-side i18n integration #2558

Merged
merged 50 commits into from
Dec 7, 2023
Merged

Conversation

kazupon
Copy link
Collaborator

@kazupon kazupon commented Nov 16, 2023

πŸ”— 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

This PR is feature PR of @intlify/h3 integration for nuxt i18n, and experimental feature.
I will also add docs.

we will consider some stuff the following:

  • locale messages (i18n resources) will be able to use nuxt i18n options as much as possible
    • set the defineI18nMiddleware in the initialization of the nitro plugin
    • but, setting up all locale messages in the nitro plugin can have a performance impact, so consider lazy loading (we should load the locale when it is detected by the locale detector).
  • server-side locale detection is done by a module that exports a user-defined locale detector function to the experimental.localeDetector option in the nuxt i18n config.
    • see about detauls for how to customize for locale detection: https://github.com/intlify/h3#%EF%B8%8F-custom-locale-detection
    • Ideally, it would be useful if locale detection could be seamlessly integrated with the nuxt i18n routing strategy and detect browserlanguage option. but, we don’t know use cases of server-side i18n, the first implementation allows users to customize locale detection on their own.

πŸ“ Checklist

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

@kazupon
Copy link
Collaborator Author

kazupon commented Nov 16, 2023

This PR is still WIP.

@kazupon kazupon changed the title feat: support server-side i18n integration WIP: feat: support server-side i18n integration Nov 16, 2023
Copy link

nuxt-studio bot commented Dec 6, 2023

βœ… Live Preview ready!

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

Copy link
Collaborator

@BobbieGoede BobbieGoede left a comment

Choose a reason for hiding this comment

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

Nice, it looks great!

Only some small fixes/changes for the docs, other than that it looks like it can be merged πŸ’ͺ

docs/content/2.guide/16.server-side-translations.md Outdated Show resolved Hide resolved
docs/content/2.guide/16.server-side-translations.md Outdated Show resolved Hide resolved
docs/content/2.guide/16.server-side-translations.md Outdated Show resolved Hide resolved
docs/content/2.guide/16.server-side-translations.md Outdated Show resolved Hide resolved
docs/content/2.guide/16.server-side-translations.md Outdated Show resolved Hide resolved
docs/content/4.API/1.composables.md Outdated Show resolved Hide resolved
docs/content/4.API/1.composables.md Outdated Show resolved Hide resolved
docs/content/4.API/1.composables.md Outdated Show resolved Hide resolved
docs/content/4.API/1.composables.md Outdated Show resolved Hide resolved
docs/content/4.API/1.composables.md Outdated Show resolved Hide resolved
kazupon and others added 9 commits December 7, 2023 08:55
Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
@kazupon
Copy link
Collaborator Author

kazupon commented Dec 6, 2023

@BobbieGoede
Thanks for your review!
I'll merge this PR!

Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
@kazupon kazupon merged commit 9bdad47 into main Dec 7, 2023
7 checks passed
@kazupon kazupon deleted the feat/intlify-h3-integration branch December 7, 2023 00:06
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
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