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

Blocks support? #82

Open
denisvlr opened this issue Aug 18, 2016 · 7 comments
Open

Blocks support? #82

denisvlr opened this issue Aug 18, 2016 · 7 comments

Comments

@denisvlr
Copy link

Hello,

Can this package work for Block translations?

Assuming we have a block such as the following one:

class PersonBlock(blocks.StructBlock):
    first_name = blocks.CharBlock(required=True)
    surname = blocks.CharBlock(required=True)
    biography = blocks.RichTextBlock()

Would it be possible to enable translations on its fields?
Applying the TranslationMixin doesn't work.

I guess it was made to only translate Pages or Snippets.

@dwasyl
Copy link
Contributor

dwasyl commented Aug 19, 2016

If you use the latest alpha release (v0.5.0a1) it doesn't need the mixin, and in theory it's just based on modeltranslation so it should work on StructBlock type models (but it doesn't).

I'd been meaning to point out the same issue, registering the StructBlock model with modeltranslation seems to fail.

@Jason-Abbott
Copy link

If I may resurrect an old issue ... we've installed 0.8 with Django 1.11.10 and wagtail 1.13.1 (all the latest, I think) and are encountering the same limitation. Trying to register a StructBlock model results in a non-iterable item error.

I don't mind working on the code and submitting a PR if I could maybe get a pointer to start.

@dmarcelino
Copy link
Collaborator

Hi @Jason-Abbott! All contributions are welcomed.

I'm not aware of what kind of subtleties StructBlock entails but I'd say the best place to start looking at the code is probably patch_wagtailadmin.py#L38-L108. From there you should get the gist of how the patching is done. Running in debug mode also helps considerably.

@Jason-Abbott
Copy link

Thanks @dmarcelino. I've started working on this. The Wagtail blocks are quite a bit different from the pages and panels since they aren't Django models so I'm approaching from another angle. I'll share when I have something.

@DiogoMarques29
Copy link
Collaborator

Hello @Jason-Abbott
Any news on this?

Cheers

@mihow
Copy link

mihow commented May 30, 2019

Has anyone attempted this yet? I may be giving it a whirl.

@prasenr
Copy link

prasenr commented Aug 17, 2022

Has anyone attempted this yet? I may be giving it a whirl.

@mihow did you attempt to fix the translation for Struckblocks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants