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

NullReferenceException when using ThreadLanguageDetector and Accept-Language header is not present #7

Closed
Shaddix opened this issue Jul 8, 2019 · 4 comments

Comments

@Shaddix
Copy link

Shaddix commented Jul 8, 2019

We receive the following exception:

System.ArgumentNullException: Value cannot be null.
  at I18Next.Net.I18NextNet.set_Language(String value)
  at I18Next.Net.Extensions.I18NextStringLocalizer.Translate(String name, Object[] arguments)

when Accept-Language header is not present in http request (e.g. from Mobile app, not web-browser).

Set up is:

services.AddI18NextLocalization(
                i18N => i18N
                    .AddLanguageDetector<ThreadLanguageDetector>()
);
@DarkLiKally
Copy link
Owner

I'll have a look, thanks for your request!

@Shaddix
Copy link
Author

Shaddix commented Jul 25, 2019

On a side-note: it's only reproducible if server's CurrentCulture is InvariantCulture.
The fix is quite easy, I'll send a pull-request in few hours

@DarkLiKally
Copy link
Owner

Thanks, I'm currently working on some more optimizations, I will schedule a new release later this day! Also merging in your pull request.

DarkLiKally added a commit that referenced this issue Jul 25, 2019
Fixes #7: NullReferenceException when using ThreadLanguageDetector an…
@DarkLiKally
Copy link
Owner

@Shaddix Release was pushed to nuget.

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

No branches or pull requests

2 participants