Using third party package for multi-language
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?
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.
Yes we can't use parler because it's really huge. Btw i really like your library first approach and low maintenance software designs. Thats why im here :)
I just like the idea of having connecting the pages between languages.
Right now i'm using changelist filter to separate the languages.

But i like the approach that parler using like this.

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 TranslatedFieldsAdmin -- the individual fields' labels do not have to contain the language code too.
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.