-
-
Notifications
You must be signed in to change notification settings - Fork 655
Disabled default returnedObjectHandler #1288
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
Conversation
…ich points to object when returnObjects is false
will be published in an upcoming version |
published in i18next@17.0.7 |
@@ -32,7 +32,7 @@ export function get() { | |||
returnEmptyString: true, // allows empty string value as valid translation | |||
returnObjects: false, | |||
joinArrays: false, // or string to join array | |||
returnedObjectHandler: () => {}, // function(key, value, options) triggered if key returns object but returnObjects is set to false | |||
returnedObjectHandler: false, // function(key, value, options) triggered if key returns object but returnObjects is set to false |
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.
@jamuhl If I get it right, somebody could expect a function here, couldn't they? If it's the case, does it break the top-level API? 🤔
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.
what are you talking about...
https://github.com/i18next/i18next/blob/master/src/Translator.js#L122
it just fixed the usage -> there should be a string returned to show something is wrong
before having a noop function it just did nothing...
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.
Yeah, I see that it's kind of default options and not used from the outside of the lib. Btw, it was just a question, not a passive-aggressive one 😄
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.
Gosh, now I'm super interested in what's actually been broken since a few recent versions 😃
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.
fun fact is v1 -> v17 is more or less the same exposed API
we still run v1.x.x tests with a compatibility mode (which was part of i18next until around v10): https://github.com/i18next/i18next/tree/master/test/backward
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.
Not taking it as aggressive - no worry - just as I try my best to not add to the "javascript-fatigue" by keeping the API as stable as possible by not breaking things. I got a little sad by the tweet.
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 got a little sad by the tweet.
Yeah, I'm sorry about that 😞
I think it'd be cool to see your answer to the initial tweet (what's actually broken and what's not) 👍
To allow returning of a key when
returnObjects
isfalse
. See #1234More discussion in #1239