A translation already exists for the specified language

Created on 9 April 2020, about 4 years ago
Updated 25 June 2024, 5 days ago

Follow-up issue for #2829283: Language support in Feed import β†’

Problem/Motivation

When mapping to the target "Language (langcode)" in some situations this results in the following error:

A translation already exists for the specified language

This could be the steps to reproduce the issue, taken from #2829283-85: Language support in Feed import β†’ :

  1. Install Drupal, standard profile, default language set to English.
  2. Enable Language, Content translation and Feeds module.
  3. Add Finnish as 2nd language, enable Basic page content to be translated.
  4. Create a Feed type with mappings to feeds item, title, body and langcode. Title and body set to English.
  5. Create a feed.
  6. Import a CSV file that has one row with langcode set to "en" and one row with langcode set to "fi".

Result: "Import failed. A translation already exists for the specified language (fi).

The CSV file could look like this:

"guid","title","body","langcode"
1,"Lorem ipsum","Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.","en"
2,"Ut wisi enim ad minim veniam","Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.","fi"

Thanks @artis.bajars for providing these steps.

Proposed resolution

To be determined.

Remaining tasks

  1. Identify when the error occurs.
  2. Write a test that demonstrates the issue.
  3. Fix the issue.
  4. Review.
  5. Commit.

User interface changes

Probably none.

API changes

To be determined.

Data model changes

To be determined.

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands MegaChriz

Live updates comments and jobs are added and updated live.
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.

  • πŸ‡³πŸ‡±Netherlands MegaChriz

    Tagging issue with "multilanguage", so I can find this issue back as soon as I plan to focus on Feeds multilingual issues again.

  • First commit to issue fork.
  • πŸ‡¨πŸ‡¦Canada nikathone Ontario

    I tried to reproduce the issue following the steps in the description but I couldn't. I ended up with two basic page content with two different languages. The two content are not connected as in being the same content with two different translation.

  • Status changed to Needs review 5 days ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update 5 days ago
    Patch Failed to Apply
  • πŸ‡΅πŸ‡ΉPortugal tmiguelv

    Hello!
    I was having the same problem as #9 and I did a little patch for importing content in the existing translations that worked for my site.
    I needed to make the feeds_item field translatable.
    For the translations to work, you need to:

    • Copy the steps from the description
    • Allow translations in the feed settings
    • Add a mapping field for an unique target (it can be ID, title, or something that will be used to relate both translations)
    • Enable translation for feeds_item field in the Content Type Settings

    Please feel free to review it and upgrade it

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update 5 days ago
    Patch Failed to Apply
  • πŸ‡΅πŸ‡ΉPortugal tmiguelv

    Added a validation to check if the language exists

Production build 0.69.0 2024