BoltTranslate / Translate

Provides translation for contenttypes.
Other
43 stars 38 forks source link

Templatefields are translated and stored correctly, but translations can't be set #22

Closed flrvt closed 8 years ago

flrvt commented 8 years ago

When using translatable templatefields, it seems like the extension's javascript is unable to set all the individual fields to its translated counterpart. I ran into this issue while using a template that has 10 fields, including html and image fields.

As I was troubleshooting this, I noticed the translated fields are correctly set in the bolt_translation table. The JSON stored there, is parseable. But when field_locale.js tries to parse & set the fields, this exception is thrown:

TypeError: Cannot read property 'setData' of undefined(…)

When I debug the js, it breaks in this loop:

for (var field in val) {
    setValue('templatefields[' + field + ']', val[field]);
}

Removing my html field does not help either...

pages:
    name: Pages
    singular_name: Page
    class: \Bolt\Extension\Animal\Translate\Content\LocalizedContent
    fields:
        locale:
            type: locale
            group: content
        title:
            type: text
            class: large
            group: content
            required: true
            isTranslatable: true
        slug:
            type: slug
            uses: title
        template:
            isTranslatable: true
            type: templateselect
        seo:
            isTranslatable: true
            type: seo
            group: "SEO settings"
    default_status: published
    record_template: page_basic.twig
templatefields:
    page_home.twig:
        banner_heading:
          label: Heading
          type: text
          class: large
          required: true
        banner_content:
          label: Content
          type: html
          height: 300px
          required: true
        banner_cta_title:
          label: Call to action text
          type: text
          class: small
          required: true
        banner_image:
          label: Banner image
          type: image
        products_heading:
          label: Products listing heading
          type: text
          class: large
          required: true
        contentblock_heading:
          label: Right column heading
          type: text
          class: large
          required: true
        contentblock_content:
          label: Right column content
          type: html
          info: "The text that will be shown in the right column."
        contentblock_cta_title:
          label: Right column call to action text
          type: text
          class: small
          required: true
        contentblock_cta_url:
          label: Right column call to action URL
          type: text
          class: small
        references_heading:
          label: Reference listing heading
          type: text
          class: large
          required: true

Details

SvanteRichter commented 8 years ago

Fixed in 37cf552, new release tagged for it too... Closing.