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: locale message file cache configuration #2357

Conversation

BobbieGoede
Copy link
Collaborator

@BobbieGoede BobbieGoede commented Aug 31, 2023

πŸ”— Linked issue

#2185
#2293

❓ 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

Resolves #2293

Changes locale message file configuration, file and files on locales can now be set to { path: string; cache?: boolean }, if cache is left unset caching be enabled by default for locale files that are not dynamic.

It was a bit difficult to think of a proper way to test whether cache configuration is taking effect as it happens internally, the added test checks this based on debug logs, perhaps there is a better way to do this.

πŸ“ Checklist

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

src/types.ts Outdated Show resolved Hide resolved
src/runtime/utils.ts Outdated Show resolved Hide resolved
@BobbieGoede BobbieGoede force-pushed the feat/locale-message-file-cache-configuration branch from 21c0a80 to 32c5691 Compare September 2, 2023 15:26
@nuxt-studio
Copy link

nuxt-studio bot commented Sep 4, 2023

βœ… Live Preview ready!

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

@BobbieGoede BobbieGoede force-pushed the feat/locale-message-file-cache-configuration branch from a3b30a0 to 7999daa Compare September 4, 2023 09:25
@BobbieGoede BobbieGoede marked this pull request as ready for review September 4, 2023 09:59
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.

Great works!
Thank you so much!

@kazupon kazupon merged commit 2eda7db into nuxt-modules:next Sep 4, 2023
4 checks passed
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
* feat: locale message file cache configuration

* test: fix types and failing errors

* fix: nuxtInternalOptions `__normalizedLocales`

* refactor: simplify types

* refactor: remove duplicate utility function

* docs: add caching section to lazy-load translations guide

* test: add test to assert cache configuration is used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to clear or disable cache when using lazy:true
2 participants