BoltTranslate / Translate

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

[BUG] Translations not working when "slug" and "singular_slug" are set and differ from the theoretically autogenerated ones #173

Closed blaues0cke closed 3 years ago

blaues0cke commented 6 years ago

So translations are working like a charm for this contenttype:

jobs:
    name: Jobs
    slug: jobs
    singular_slug: job
    singular_name: Job
    fields:
        locale:
            type: locale
            group: content
        title:
            type: text
            group: content
            label: Titel
            translatable: true
        sort_by:
            type: integer
            label: Sortierung
        slug:
            type: slug
            uses: title
            translatable: true
        text:
            type: html
            label: Beschreibung
            translatable: true
        dedata:
            type: hidden
        deslug:
            type: locale_data
            index: true
        endata:
            type: hidden
        enslug:
            type: locale_data
            index: true

    taxonomy: [  ]
    listing_records: 20
    recordsperpage: 20
    sort: 'sort_by'
    default_status: published
    record_template: page.twig
    listing_template: pages.twig

But when I change slug and/or singular_slug the dedata and endata fields are now longer maintained and the locale is stored in the original fields:

jobs:
    name: Jobs
    slug: jobsfoo
    singular_slug: jobfoo
    singular_name: Job
    fields:
        locale:
            type: locale
            group: content
        title:
            type: text
            group: content
            label: Titel
            translatable: true
        sort_by:
            type: integer
            label: Sortierung
        slug:
            type: slug
            uses: title
            translatable: true
        text:
            type: html
            label: Beschreibung
            translatable: true
        dedata:
            type: hidden
        deslug:
            type: locale_data
            index: true
        endata:
            type: hidden
        enslug:
            type: locale_data
            index: true

    taxonomy: [  ]
    listing_records: 20
    recordsperpage: 20
    sort: 'sort_by'
    default_status: published
    record_template: page.twig
    listing_template: pages.twig

Details

Reproduction

1) Add this content type:

jobs:
    name: Jobs
    slug: jobsfoo
    singular_slug: jobfoo
    singular_name: Job
    fields:
        locale:
            type: locale
            group: content
        title:
            type: text
            group: content
            label: Titel
            translatable: true
        sort_by:
            type: integer
            label: Sortierung
        slug:
            type: slug
            uses: title
            translatable: true
        text:
            type: html
            label: Beschreibung
            translatable: true
        dedata:
            type: hidden
        deslug:
            type: locale_data
            index: true
        endata:
            type: hidden
        enslug:
            type: locale_data
            index: true

    taxonomy: [  ]
    listing_records: 20
    recordsperpage: 20
    sort: 'sort_by'
    default_status: published
    record_template: page.twig
    listing_template: pages.twig

2) Add a new job 3) Change the locale 4) Edit the job title 5) The job title is changed over all locales

Expected: The locale only should be changed for the selected/active language.

blaues0cke commented 6 years ago

A working workaround for this just to remove slug and singular_slug. Its also possible then to delete the new generated (different) mysql table and rename the old one that still exists behind the scenes to the correct/new name.

blaues0cke commented 6 years ago

This also occurs when the name of the content type contains a underscore (_). So this works:

restaurantmenuitem:
    name: Speisekarten-Einträge
    singular_name: Speisekarten-Eintrag

and this not:

restaurant_menu_item:
    name: Speisekarten-Einträge
    singular_name: Speisekarten-Eintrag
Spomsoree commented 4 years ago

I just run into the underscore issue.

Wasted some time on figuring this out.