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

Django 1.8 and Translations #118

Closed
TheRightChoyce opened this issue May 12, 2015 · 5 comments
Closed

Django 1.8 and Translations #118

TheRightChoyce opened this issue May 12, 2015 · 5 comments

Comments

@TheRightChoyce
Copy link

I monkey patched the pull request in #114, however I ran into another issue when translations are getting deferred: In Django 1.8 translation.get_translation() has changed to return None when translations are being deferred (link), and in my case, line 105 of models/fields.py

locale = translation.to_locale(translation.get_language())

was throwing the error: AttributeError: 'NoneType' object has no attribute 'find' since translation.get_language() was returning None with the new functionality. I fixed my local version the following way, however this seems pretty incorrect in the grand scheme of things

language = translation.get_language() or settings.LANGUAGE_CODE
locale = translation.to_locale(language)

I don't really know the proper way to fix this, so leaving here and hopefully someone with more knowledge of both code-bases can fix = )

@briankung
Copy link
Contributor

Would you be able to write a failing test for the translation error and publish your code somewhere?

@TheRightChoyce
Copy link
Author

It may take me a little while to get to it, but I'll try putting one together as soon as I'm back on the project where I found this.

@briankung
Copy link
Contributor

👍

@YAmikep
Copy link
Contributor

YAmikep commented Aug 6, 2015

Got the same issue on django 1.8. I did not see this ticket so I actually created one too. Sorry about that.

I used the same fix @TheRightChoyce mentions here and I created a pull request too: #125

Any chance to see this bug fixed soon? Thanks

@benjaoming
Copy link
Contributor

Fixed in #125

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

4 participants