-
Notifications
You must be signed in to change notification settings - Fork 12
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
Using third party package for multi-language #13
Comments
What would you use parler or translated fields for? Translating page titles etc? How would you fill in the content for different languages? Or add translated fields to all plugins? We mostly work with one page tree per language. Sometimes, having to duplicate the same changes in the tree in different places is annoying, but the liberty gained by not having to synchronize everything is worth it (for us, maybe not for everyone). Editing content in only one language at a time seems to give a less cluttered interface. Regarding parler vs. translated fields: If I wanted to use parler or modeltranslation I wouldn't have started developing a different package for the same thing :-) just today I lost an hour to modeltranslations' idiosyncrasies resp. to its magic behavior. More: https://406.ch/writing/django-translated-fields-localized-model-fields-without-magic/ |
Btw, https://www.dwheeler.com/sloccount/ really isn't everything, but for django-translated-fields it reports 77 lines and for django-parler 2009 lines of code (both excluding tests) So in terms of complexity there's a big big difference. |
Hmm maybe there is an easy way to replicate this interface using django-content-editor's tabbed fieldsets? Completely untested: @admin.register(models.Stuff)
class StuffAdmin(admin.ModelAdmin):
class Media:
css = {"all": ["content_editor/content_editor.css"]},
js = [
"content_editor/jquery-ui-1.11.4.custom.min.js",
"content_editor/tabbed_fieldsets.js",
]
def get_fieldsets(self, request, obj=None):
unspecific_fields = []
specific_fields = defaultdict(list)
for field in self.model._meta.get_fields():
if not field.editable: # Maybe other criteria to skip?
continue
if hasattr(field, "_translated_field_language_code"):
specific_fields[field._translated_field_language_code].append(field.name)
else:
unspecific_fields.append(field.name)
fieldsets = [
(None, {"fields": unspecific_fields}),
]
for language_code, language_title in settings.LANGUAGES:
fieldsets.append((language_title, {"fields": specific_fields[language_code], "classes": ("tabbed",)}))
return fieldsets Since we're collecting all fields into language-specific fieldsets I wouldn't use |
I will try to come up with something later. But i don't know that you want to accept pull request that all languages are managed on one tree? |
I was just thinking again about this (sorry for the long wait) I don't remember which project, but I experimented with a multilingual page tree once. The page model didn't require many changes but supporting both in the official feincms3 package -- I'm not sure about that. I would prefer to do it the same way feincms3-sites does it, with an external package with its own page model. The documentation for feincms3-sites is part of the official documentation and I would certainly agree to expand the guide on multilingual sites to include a discussion of this additional option too. |
Hi @matthiask
What do you think about using django-parler or your repo django-translated-fields for multi-language functionality in feincms3.
And what do you think drawbacks are ?
Btw. I need to implement drag&drop functionality for client using jstree or something. Will you accept pr for this?
The text was updated successfully, but these errors were encountered: