-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fallback to default language if field is empty #5
base: master
Are you sure you want to change the base?
Conversation
Thanks again for the suggestions. It's great to get feedback from people using this app. But this one is a little controversial with the other devs at my company. I agree that it is consistent with i18n / gettext, but not sure if I agree with this behaviour. One of the reasons pointed out was that this behaviour hides the fact that you're missing a translation. This issue is also related to the "content to be translated later" problem. Right now, if I had a "not null" translatable field, I MUST fill in ALL translations before saving or else the db will give me an error. I'm going to think about this one, not quite sold on merging it in yet. |
Hi Matthew, The final decision is of course yours but let me try to convince you why I think my proposed behavior makes sense ;) So I believe there are two issues, which I believe are slightly different:
In my case, having a fall back is important because I'm integrating linguo to an already existing project with an existing model. When south creates non blank fields, south will ask for defaults. The only sensible values are "" (empty string) or |
now accounts for none and empty
changed test for language fallback
First of all thanks for the app, it is really useful. I would propose, to address the point number 2, that we add a setting (that can be turned on for instance on a development or qa environment) that when no translation is provided returns a [MISSING TRANSLATION] string instead of falling back to indicate the missing translation. We could also add a setting to disable the fallback so that the changes don't impact apps already in production. I can make this change if there is real interest in pursuing this fallback approach because i would really enjoy to go back to the canonical version of the app instead of pointing to my fork. |
Hello,
I use linguo in a project where not all products are translated - and for these products I have to display the original text.
I modified
MultilingualModel
'sgetter
to fallback to the default language so instead of doing:I can do:
There are a few reasons why I think this is good:
Obviously, this change breaks a few tests that expect non translated fields to return an empty string. But I'll update those if you plan on merging this in.
If you're worried about breaking existing projects, we can also make this behavior optional through a flag in settings.py (LINGUO_FALLBACK).
Let me know what you think!
Regards,
Selwin