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

Added conditional warning on unmatched variable during interpolation #160

Merged
merged 1 commit into from Jul 9, 2016

Conversation

@aray12
Copy link
Contributor

aray12 commented Jul 8, 2016

I mentioned in #157 that it would be nice to receive a warning if no matching prop was provided during interpolation. I noticed that if you use i18n.t to try and translate a value that has a variable in it you get the following warning

i18next::interpolator: missed to pass in variable test for interpolating Some value {{test}}

I added a basic conditional check that this.props[match] actually exists. If it doesn't it calls this.i18n.services.logger.warn and essentially mimic the exact same behavior as if you had used that translation with just the standard i18n.t function.

First, I appreciate the work you guys have done. This is definitely the most enjoyable i18n software I have found. Second, I have not committed to OSS much, so forgive me if this is a naive solution. If you have any feedback I will gladly improve on this.

@jamuhl jamuhl merged commit 9d08eb9 into i18next:master Jul 9, 2016
@jamuhl

This comment has been minimized.

Copy link
Member

jamuhl commented Jul 9, 2016

looks ok to me...just published react-i18next@1.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.