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

[Bug/Feature request] Add compatibility with Translate plugin in Static Pages #31

Open
nmiyazaki-chapleau opened this issue May 17, 2024 · 3 comments

Comments

@nmiyazaki-chapleau
Copy link

nmiyazaki-chapleau commented May 17, 2024

TL;DR: Winter Translate plugin doesn't work with this plugin in Static Pages, because Translate doesn't understand Blocks' multiple levels system. This makes all Translate fields refer to the same field name, and ends up replacing the values of all form fields within blocks that have the same FormField->fieldName.

Given the following block definition:

name: block
fields:
    content:
        label: Title
        type: mltext
==
<div>{{content}}</div>

Adding two of these blocks to a static page will cause both of them to always have the same value.

Steps:

  1. Add this block to a static page twice with different values
  2. Save and refresh the page
  3. The values of both blocks should be the same as the last block's original value.

This is because Translate will create fields in the forms with the name "RLTranslate[en][content]" for the locale-dependant field.
Furthermore, after saving the default locale's value and refreshing the page, the other locale's value is completely messed up, showing the raw content of the static page of the other locale (static-pages-fr/whatever.htm's content, which is [viewBag] title = "abc" == ).

I have only recently started developping websites using WinterCMS, and tried to fix this for a couple of hours with no success due to my lack of knowledge with its backend / inner workings.

Any kind of fix or workaround would be appreciated, as this is a big blocker for my team right now (even a hardcoded change to a plugin file is fine!).

WinterCMS 1.2.6

@nmiyazaki-chapleau
Copy link
Author

Although there are multiple workarounds, such as creating a language block or simply using an MLRepeater field as the first item, both of these have the same issue: duplicating lots of content simply to translate a few fields. Furthermore, there's no "duplicate" button or anything or the sort, so people have to manually recreate the same content in every locale, which is quickly tedious.
Then again, the implementation seems hard, and it almost seems simpler to have a translation option within the Blocks plugin itself rather than trying to integrate the Translate plugin, since Translate's inner workings are simply not compatible with Blocks.

@LukeTowers
Copy link
Member

@mjauvin any thoughts?

@mjauvin
Copy link
Member

mjauvin commented May 21, 2024

It may eventually be possible to make it work when this PR is completed.

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

No branches or pull requests

3 participants