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!: vueI18n options from config path #1973

Merged
merged 14 commits into from
Apr 12, 2023
Merged

refactor!: vueI18n options from config path #1973

merged 14 commits into from
Apr 12, 2023

Conversation

kazupon
Copy link
Collaborator

@kazupon kazupon commented Apr 2, 2023

πŸ”— Linked issue

closes #1948

❓ 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

ref: #1948

πŸ“ Checklist

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

@kazupon kazupon changed the title I18n options refactor!: vueI18n options from config path Apr 2, 2023
src/gen.ts Outdated
// }`
// genCodes += ` ${rootKey}.${key} = await ${optionLoaderVariable}(context)\n`
genCodes += ` ${rootKey}.${key} = ${vueI18nConfigPath != null ? 'vueI18nOptions' : {} }\n`
genCodes += ` if (${rootKey}.${key}.messages) { console.warn("[${NUXT_I18N_MODULE_ID}]: Cannot include 'messages' option in '${value}'. Please use Lazy-load translations."); ${rootKey}.${key}.messages = {}; }\n`
Copy link
Collaborator Author

@kazupon kazupon Apr 2, 2023

Choose a reason for hiding this comment

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

MEMO(TODO):
If we have messages options, we must pre-compile the resource using dynamic import & bundler (virtual module) at i18n.options.mjs (gen.ts). This is because, in production, vue-i18n assumes that the resource is pre-compiled.

@kazupon kazupon marked this pull request as ready for review April 10, 2023 07:59
@ineshbose
Copy link
Collaborator

Minor future task: allow configuration from app.config.ts and extending (@nuxt/schema).AppConfig

@kazupon kazupon merged commit f7925d1 into next Apr 12, 2023
8 checks passed
@kazupon kazupon deleted the i18n-options branch April 12, 2023 14:32
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
* docs: mention callbacks

* chore: initial commit

* chore: progress

* chore: updating minor bits and tests

* refactor!: `vueI18n` options from config path

* fix: complete config load implementation

* updates

* fix: unit tests

* fix: e2e testing

* update lock file

* tweak docs

---------

Co-authored-by: Inesh Bose <2504266b@student.gla.ac.uk>
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