-
-
Notifications
You must be signed in to change notification settings - Fork 483
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!: read vue-i18n options from config path #1948
Conversation
@ kazupon, please feel free to share thoughts at your convenience. I expect the change to be slightly big in certain areas but I'll only finalise things after the previously proposed PRs have been tackled. Btw, should the default config file be named |
Yeah! your idea sounds good. |
vueI18n?: I18nOptions | string | ||
vueI18n?: { | ||
configFile?: string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope the i18n options keep I18nOptions | string
because it would break compatibility with v7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would need to be string
for this change. Sorry if I'm misunderstanding but why is compatibility with v7 important (since this is another major version)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, v8 is a major version, so breaking changes are inevitable.
Upgrading to a major version for a large application that has already been built is a huge effort.
Some frameworks (e.g. larave, rails, and react) have been released so that major versions do not cause too much work for the user's application. They are releasing features supported in previous versions in working order, just as Vue3 supports the Options API.
I have once again thought about how much breaking change would detract from the migration experience for the user.
In this PR, it is a change in the configuration interface, so the affected code point is local.
Changing the vueI18n option would not be much of a problem.
Of course, we need to write a migration guide in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely - it would be great to have as less breaking changes as possible.
Similar to #1919 also moving some fragile configuration options to other solutions that Nuxt provides for stability, I'm aiming to do the same here. This may have been a small weak-point in v7, so having this solved in v8 would be great. The migration would indeed be documented.
PR would also possibly tackle this- Line 9 in 7943ca1
|
Could you prioritize this PR over other tasks? π |
} | ||
} | ||
}) | ||
``` | ||
|
||
The `vueI18n` option is the same as `createI18n` function option of Vue I18n. `vueI18n` option is passed to the `createI18n` function via the nuxt plugin of this module internally. | ||
The `defineI18nConfig` function is the same as `createI18n` function option of Vue I18n. The configuration is passed to the `createI18n` function via the nuxt plugin (runtime) of this module internally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should name defineIVue18nConfig
, not defineI18nConfig
, because that is coniguration forvueI18n
option. And some people might misunderstand it as a nuxt i18n setting.
'@nuxtjs/i18n' | ||
], | ||
i18n: { | ||
vueI18n: { configPath: './nuxt-i18n.js' } // custom path example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vueI18n
option may no longer be optional. It's recommended to autoload i18n.config.ts
if we have a config that conforms to the convention. If we have a nonconventional config file name, we can specify it in the vueI18n
option!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, sorry, Never mind this comment.
I was misreading. π
In additions, we also need to fix the basic usage docs. |
Hi @kazupon I wanted to formalise the context to this PR with complete transparency so that everyone is on the same page! This module provides enabling Based on Nuxt's official guide on a project's contexts - "they are not supposed to share state, code, or context" (also why With all that said, this is a massive change that will need to be tested intensively, and for me, as an amateur, to carry this out since I only have such little understanding of how the module and code generation is working, I will need some great help and great guidance. I can't say what steps to take forward, but I'm looking to hear from the lead developer (aka you π) if have some plans or feedback on how this can be facilitated or just cancelled (which I'm open to, but I believe it would continue with the code debt). Let me know - and we can continue a close discussion over Discord if required. π |
Hi! @ineshbose I was understanding the current problems with the The implementation using So, I have considered whether there is any compromise for the RC release. Fortunately, The loaded file is processed by the bundler (vite), so that even if functions such as modifiers are set, they can be safely processed.
If In the RC release, we can accept configuration by Object, but in the v8 official release or RC patch version release, we will discontinue that support and That way, I believe we can make changes to What do you think? |
β Type of change
π Description
Options would need to be passed from a separate file that will be imported by the plugin. This idea is inspired from looking at other modules that require runtime configuration. Please feel free to discuss over Discord about this change.
WORK IN PROGRESS
π Checklist