-
-
Notifications
You must be signed in to change notification settings - Fork 861
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: add a new option fallbackRootWithEmptyString #1441
feat: add a new option fallbackRootWithEmptyString #1441
Conversation
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.
Oh, I have not realized I was having a BREAKING CHANGE in v9 😣
This option should be useful when migrating from v8 to v9 for some users.
This should be documented in the API docs (api.md).
And we need to add the typescript type definition as well.
https://github.com/kazupon/vue-i18n/blob/v8.x/types/index.d.ts
Sure. I will add this in |
c853de6
to
4e5fdf9
Compare
I added this in PS: Please note that the added description in PPS: And I didn't regenerate the docs cause IMO docs should only be regenerated before a new release. |
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.
OK! Thanks!
It looks good to me! :)
This PR introduces a new option
fallbackRootWithEmptyString
. This option decides a i18n message should fallback to root or not if it's a empty string.Currently, the fallback root check logic is like this:
This means that: in the case that the
val
is an empty string(''), it will also fallback to root. This implementation is different from the one in version 9.x(in i18n 9.x, the empty string will not trigger fallback root). Besides that, this implementation may make it difficult if the user want to bypass the fallback operations of some value.This PR introduces a new option
fallbackRootWithEmptyString
whose default value istrue
. It means the default logic of fallback root is still like this :This means the PR is not a breaking change: by default, the fallback root logic will work in the existing logic.
When setting the
fallbackRootWithEmptyString
to befalse
m the fallback root logic will become like this:This means the emptr string('') will not trigger fallback root.
Besides that, I didn't add this option in the
api.md
, cause I want to hear your ideas about this new option first. :) @kazupon