Skip to content

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

Merged
merged 1 commit into from
Jul 19, 2019
Merged

Disabled default returnedObjectHandler #1288

merged 1 commit into from
Jul 19, 2019

Conversation

acc15
Copy link

@acc15 acc15 commented Jul 19, 2019

To allow returning of a key when returnObjects is false. See #1234

More discussion in #1239

…ich points to object when returnObjects is false
@coveralls
Copy link

Coverage Status

Coverage remained the same at 89.013% when pulling 8a7944b on acc15:master into 744e57b on i18next:master.

@jamuhl jamuhl merged commit b915954 into i18next:master Jul 19, 2019
@jamuhl
Copy link
Member

jamuhl commented Jul 19, 2019

will be published in an upcoming version

@jamuhl
Copy link
Member

jamuhl commented Jul 29, 2019

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
Copy link

@vitkarpov vitkarpov Aug 7, 2019

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? 🤔

Copy link
Member

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...

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 😄

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 😃

Copy link
Member

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

Copy link
Member

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.

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) 👍

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.

4 participants