Field added with the non-default language are not translatable

Created on 19 September 2017, over 6 years ago
Updated 13 March 2024, 3 months ago

Problem/Motivation

Translating a field is not possible if you use the admin interface in the non-default language to add it.

You end up with a error message

 The configuration objects have different language codes so they cannot be translated:
 - field.feidl.node.event.body: en
 - field.storage.node.body: fr        

How to reproduce
1) install drupal in FR
2) activate config translation
3) add english language
3) add the body field (will in EN) in a new content type
4) try to translate this field
5) boum!

Steps to reproduce

Proposed resolution

Remaining tasks

Search for duplicates for the problem stated in #11 and #12
Confirm that this is happening on a supported version of Drupal

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Config translation 

Last updated about 1 month ago

Created by

🇨🇭Switzerland gagarine

Live updates comments and jobs are added and updated live.
  • D8MI

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand quietone New Zealand

    I tested this on Drupal 10.1.x, installed in Italian. i was not able to reproduce the problem in the Issue Summary. That would make this outdated.

    However, #11 and #12 are possible out of scope. There are other issues about tags and translations and perhaps those are a duplicate of one of those.
    Although, I did not find a duplicate.

    One year ago, #14, it was reported that this was a problem on Drupal 8.9.18, which is no longer supported. So, itsthis happening on a supported version of Drupal? And, if so, how to replicate it?

    This needs more information, and to check for duplicates.

    If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").

    Thanks!

  • Status changed to Closed: works as designed 7 months ago
  • 🇳🇿New Zealand quietone New Zealand

    The information need to continue with this issue, asked for in #22, has not been supplied in the past eight months. Therefor, I am closing this. If this is incorrect reopen the issue, by setting the status to 'Active', and add a comment explaining what still needs to be done.
    Thanks!

  • Status changed to Active 5 months ago
  • 🇫🇷France ericdsd France

    Hi i'm reopening this issue as i axperience the same thing on core 10.2.1.

    English is default but has en path prefix
    French has no prefix and i used "Selected language" as last language selector.

    My admininistration language is set to french and "Account administration pages" is enabled as first language selector.
    (Note i have the same behaviour with Account administration pages disabled)

    I create an english vocabulary and when i add an existing field (which is in english) from admin/structure/taxonomy/manage/theme/overview, then i cannot translate this field.

    Les objets de configuration ont un code de langue différent, ils ne peuvent donc pas être traduits :

    field.field.taxonomy_term.theme.field_class : fr
    field.storage.taxonomy_term.field_class : en

    If i do the same from en/admin/structure/taxonomy/manage/theme/overview
    then my field has consistent langcodes in config and is translatable.

    Workaround : if i set my user's Administration page to english then it forces "en" prefix on field creation page and allows making sure the field is created with consistent langcodes (en).

  • Today this problem happened to me as well.

    Setup: Drupal 10.2.3
    Languages: de, en
    Default language: de
    Urls have language code prefixes, e. g. /en/admin/structure/types/manage/issue
    Initial installation via drush (Drupal 10.1.?):

    drush site:install --yes --db-url="..." --locale="de" --site-name="..." --config-dir="..." --site-mail="..." --account-mail="..." --account-name="..."

    I created the content type with the /en/... route and tried to translate the body afterwards. I also created a field with the /en/... route and tried to translate that afterwards.

    Both variants resulted in the mentioned error message: "The configuration objects have different language codes so they cannot be translated".

    Deleting the new content type and the new field and recreating them with the /de/... route worked.

    Now I know, that I must configure such things in the default language. But I actually like using the user interface in German to know how it looks to clients, but always configure in English to get untranslated error messages, that can be copied into a search engine.

  • 🇫🇷France erwangel

    Problem encountered with user account fields on Drupal 10.2.4.
    - Sites's default language is "fr", and two other languages activated "en" + "el"
    - In admin's profile Language settings: "Site language" is "fr", "Administration pages language" is "en".
    - Field settings "Users may translate this field" is "off"

    The problem doesn't occur on all custom fields, but on newly created fields.

    Newly created custom fields take original language "en"
    Example creating a new "text plain" field. I add translations for "en" and "el"
    As all my other fields have original language "fr" (they come from a D7 migration, D7 site wasn't multilingual and had default language "fr"). Wanting to have coherence through languages, I set the newly created field to original "fr" by executing

    drush cset field.field.user.user.field_test_text langcode fr
    drush cset field.storage.user.field_test_text langcode fr
    

    Result: I have language original "fr" but "en" translation disappeared while "el" is preserved and is still here. I click to add translation "en". The modal window opens but when I save the translation I get

    Status message
    English translation was not added. To add a translation, you must modify the configuration

    I understand that I have to edit the field (supposed to be now in original "fr") and so do I. After saving it, apparently it has been saved in "en" instead of "fr" because I get

    Warning message
    The configuration objects have different language codes so they cannot be translated:
    field.field.user.user.field_test_text: fr
    field.storage.user.field_test_text: en

    Similar issue with metatag field.

    - My conclusion is that whatever the original language is, when the field settings page is saved, drupal reverts the original language to the admin's "Administration pages language". There is some logic there although I could expect save a "fr" version when I edit a "fr" version. But what happens when your site has two admins with different setting for "Administration pages language" in their profile ? Field's original language will be reverted in the admin's language each time one edits the field and such erasing the other admin's translation.
    - My recommendation: drupal should respect the field's original language even when the admin's language is different. Perhaps we should have a language selector for the original/default field language at field level like in multilingual content types in case one wants to change the original language instead of the drush "cset" command.
    - That said, I don't understand why this happens only to newly created fields and not on old ones (those coming from the D7 migration).

Production build 0.69.0 2024