Skip to content

Multi-language Inputfields on single-language Pages #1118

@BernhardBaumrock

Description

@BernhardBaumrock

Short description of the issue

If you have multilang Inputfields on a Page that has setting noLang = 1 the Inputfield will still be a multilang Inputfield. So far, so good and correct, but if you also set noLang = 1 for this field, you'll have a problem! The value of the input will be dependent on the user's current language and not on the active language of the page being edited!

Expected behavior

The Inputfield's value should be stored and viewed in the language that is set for the page (default language).

Actual behavior

The value will be stored depending on the user's language and therefore result in unexpected and different results!

Example:

I have a multilang site with 2 languages: default = German, english = English. I also have a template FOO that is set to noLang = 1 (as the frontend of this site is only in german and the backend is multi-language for different editors).

Editor DE has a german backend and edits page example page with a file field set to description rows = 1, noLang = 1. The inputfield shows only one row for the description, so he inputs Datei-Beschreibung in Deutsch.

Now Editor EN opens this page and does not see a file description! She inputs File-description in english and saves the page.

Now we have 2 values for the same thing: A german and an english value for a file description on a single-language page that should only have a german file-description! On the frontend EN will never see her description that she just saved to that page. The only way to change the file description shown in the frontend would be to change her language in the backend to default (german) and then save the page again.

I understand that multi-lang fields must still be multi-lang fields under the hood as you've already explained to me here: #963 But the Inputfield/Fieldtype should IMHO really take care of saving the input value to the correct language - namely the language of the page and not to the language of the user!

I guess this behaviour also affects all other multi-language inputfields!

Steps to reproduce the issue

  1. Setup a multilang site
  2. Setup 2 languages
  3. Setup a template noLang = 1
  4. Add a file field with a single discription input and also setting noLang = 1
  5. Set your user's language to lang nr. 1
  6. Input some text lang 1
  7. Save the page, you'll see the saved value
  8. Change the language to lang nr. 2, you'll see an empty value for your file description
  9. Input other text lang 2
  10. Save and see other text lang 2 as value
  11. Change back to lang nr. 1 and you'll see some text lang 1 again

Setup/Environment

  • ProcessWire version: 3.0.152

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions