MetaModels / attribute_translatedalias

The translated alias attribute
GNU Lesser General Public License v3.0
0 stars 4 forks source link

Translated alias is not regenerated in translation #17

Closed bezin closed 4 years ago

bezin commented 6 years ago

Hi everyone,

it seems to me that the translated alias generation is not handled correctly: In a multilanguage setup with German (Fallback) and English, the translated alias gets not regenerated under certain conditions.

To reproduce:

  1. Have a translated Meta Model with a translated title and an translated alias generated from this title.
  2. Add German translation with title = "Foo Bar" and save.
  3. The German alias will be "foo-bar"
  4. Switch to Englisch and translate title = "Foo baz" and save

The English alias will still be "foo-bar". I would expect it to be 'foo-baz' though.

One could of course set "Force generate", but I need to give the editors the option to manually edit the alias.

Environment

Contao 4.4.21 MM 2.1 (Most recent dev-feature/contao4)

zonky2 commented 6 years ago

if you switch to the language English, you have as default the values from German in the input fields - at the alias "foo-bar"...

The alias is not overwritten because the field already contains something... :(

slight dilemma

... we need to have a discussion

Note! if you change from the default language to another language, you will see the entries from your default language in the input fields at "Create" - but they will only be "displayed" and thus not saved!

For example, you can check translatedtext - no data record is added.

Only if you change the values, these are stored - this is to be considered e.g. with "marketing" what is equal in DE and EN.

see https://github.com/contao-community-alliance/dc-general/issues/343

Maybe you can contribute to the implementation of the feature?...

bezin commented 6 years ago

if you switch to the language English, you have as default the values from German in the input fields - at the alias "foo-bar"... The alias is not overwritten because the field already contains something... :(

I know :-)

I am not sure, if you wanna discuss whether this is a bug at all or just possible solutions, hence I'll elaborate:

To me the initial issue described by me clearly is a bug. An translated alias that depends on a translated text field should obviously generate the English alias from the English title and the German alias from the German title. So if there was no English title, but the editor added one and saved it, the system should generate an English alias, because the field it dependet on, changed (from an empty English title to whatever it is after editing).

if you change from the default language to another language, you will see the entries from your default language in the input fields at "Create" - but they will only be "displayed" and thus not saved! For example, you can check translatedtext - no data record is added.

As I described, I did change the title in the second language (from 'Foo Bar' to 'Foo Baz'). This value will be stored correctly. However the translated alias checks, if it already has a value and it does this check against the German value, which is wrong. It must check against the English value that is empty at that point and generate an alias from the English title.

I still see the issue you linked and I am totally with you in that case! It really is an UX difficulty causing confusion among editors. We have that topic on our list and I try to suggest some ideas on how to tackle this.

zonky2 commented 6 years ago

see also https://github.com/contao-community-alliance/dc-general/issues/343

zonky2 commented 4 years ago

worked in MM 2.2 - maybe in MM 2.1 DE: Foo Bar => foo-bar EN: Foo Baz => foo-baz