-
Notifications
You must be signed in to change notification settings - Fork 261
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
Adds a language option to the update_translation_fields commands #563
Conversation
pyproject.toml
Outdated
[tool.poetry.dev-dependencies] | ||
pdbpp = "^0.10.2" | ||
flake8 = "^3.7.9" | ||
six = "^1.15.0" |
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.
Why are your files contains ^M characters?
https://stackoverflow.com/questions/1889559/git-diff-to-ignore-m
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 have no idea... Maybe because I'm on Windows?
Tried editing the file on Github, but it didn't work.
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.
Should I delete this file?
I've only added six because the test suite wouldn't run otherwise, but it not integral to the PR.
Fix unused var
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.
This is to fix the unused COMMASPACE variable
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.
FIxed COMMASPACE, but need advice on ^M issue.
pyproject.toml
Outdated
[tool.poetry.dev-dependencies] | ||
pdbpp = "^0.10.2" | ||
flake8 = "^3.7.9" | ||
six = "^1.15.0" |
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.
Should I delete this file?
I've only added six because the test suite wouldn't run otherwise, but it not integral to the PR.
@MrCordeiro yes, you'd better delete this line. If you install it with |
@MrCordeiro as for advice on ^M - have you followed link to stackoverflow? https://stackoverflow.com/questions/1889559/git-diff-to-ignore-m You should enable |
Line deleted, as it was merely ancillary. (I had followed the link, but was unable to understand that stackoverflow discussion :-/ ...) |
Thanks, merged it! |
Now, not only the default language will have its translation field populated, but you can provide a
--language
option to populate any other language listed on yoursettings.py
.My use case was as follows:
I needed to search an Object by its
name
field, like so:But when someone from Italy tried searching for a translatable object, it would look for the
name_it
field only. If that field was empty, it wouldn't search into the defaultname
field as well. The most straightforward solution was to populate all translatable fields regardless of whether they were using the default language or not.So, if I run:
All the empty
name_it
fields that are empty will contain the value from thename
field.