BoltTranslate / Translate

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

[BUG] Records variable empty when key and slug are different #164

Open Mahan-F opened 6 years ago

Mahan-F commented 6 years ago

I made a contenttype with the key companyAtMedia and the slug company-at-media, I need the contenttype slug to be that because that is the URL for the listing page. And I cannot have hyphens in the contenttype key.

When I go to the listing page, the template loads but the records variable is empty even though I have added a few records, as soon as I remove the translate settings from the contenttype the records load. As the user xiao mentioned on Slack, translate might be looking at the keys instead of the slug of the contenttype.

I cannot not use hyphens for the URL because it is a redesign of a website so the page URLs must stay the same as previous website and I cannot use hyphens in contenttype keys because bolt gives an error saying to change it.

This is my contenttype:

companyAtMedia:
    name: Company at media
    slug: company-at-media
    singular_name: Media post
    singular_slug: media-post
    fields:
        title:
            type: text
            required: true
            group: content
            translatable: true
        slug:
            type: slug
            uses: title
        summary:
            type: html
            label: Post summary
            required: true
            translatable: true
        content:
            type: html
            label: Post body
            required: true
            translatable: true
        image:
            type: image
            label: Post photo
            required: false
            upload: news
            extensions: [ gif, jpg, png ]
        description:
            type: text
            label: Description for search engines
            info: max 160 characters
            group: SEO
            translatable: true
        locale:
            type: locale
        fadata:
            type: hidden
        faslug:
            type: locale_data
            index: true
        endata:
            type: hidden
        enslug:
            type: locale_data
            index: true
        trdata:
            type: hidden
        trslug:
            type: locale_data
            index: true
        aedata:
            type: hidden
        aeslug:
            type: locale_data
            index: true
    default_status: published
    listing_template: pages/company_at_media.twig
    listing_records: 5
    icon_many: "fa:bullhorn"
    icon_one: "fa:bullhorn"

Details

Reproduction

You can use the same contenttype settings as I posted above and create a an empty template for listing and just dump(records) to see that it is empty.