Problem/Motivation

When executing locale updates any existing config translations are overridden by interface translations if the source string is the same. Expectation is that if you edit a config translation it shouldn't be overridden by locale updates.

Steps to reproduce

  1. I have some country names translated in locale E.g. United States = アメリカ in Japanese.
  2. We display country names in a language selector. That information is stored in simple config.
  3. Feedback from client was that country names should be displayed in their own language in the language selector. Translations should still exist in other contexts though.
  4. Put United States for the translation of United States in the Japanese config for the language selector. You could even delete the whole config file.
  5. Re-import locale like so: drush locale:import --type customized --override customized ja /app/translations/ja.po
  6. Export your config. You will notice that the config has been overridden with アメリカ

Proposed resolution

Determine if this is a bug or if a new option needs to be added to config to stop it getting overridden.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

L_VanDamme created an issue. See original summary.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mattew’s picture

Encountered the same issue, on our website some migration modules are enabled then disabled on daily basis to perform some migration sync, it triggers \Drupal\locale\LocaleConfigManager::saveTranslationActive which was overriding our config values.

Our website is in french (default language), single language. So our config strings provided in the install folders of our custom modules were written in FR. So the solution for us was to make sure this yml files in these install folders provides the langcode property with a value of fr! Just modifying this install yml files fixed the problem! The solution is ridiculously easy regarding the damn difficulty to debug it...

pasqualle’s picture

Status: Active » Closed (duplicate)
Related issues: +#2806009: Installing a module causes translations to be overwritten

This seems like a duplicate of #2806009: Installing a module causes translations to be overwritten. Comment #76 contains a patch to never override config translations with interface translations.
As a side effect configs need to be translated manually, as with that patch no automatic translation is happening from the known interface translation.

Other half related issue is #3150540: Configuration langcode is forced to site default language to make sure your config language does not change at import.

achap’s picture

Status: Closed (duplicate) » Active

I think this should be re-opened. A number of people in the referenced ticket are still experiencing the issue described even after the fix. It is happening to me in the following scenario on Drupal 10.3

* I have some country names translated in locale E.g. United States = アメリカ in Japanese.
* We display country names in a language selector. That information is stored in simple config.
* Feedback from client was that country names should be displayed in their own language in the language selector. Translations should still exist in other contexts though.
* Put United States for the translation of United States in the Japanese config for the language selector. You could even delete the whole config file.
* Re-import locale like so: drush locale:import --type customized --override customized ja /app/translations/ja.po
* Export your config. You will notice that the config has been overridden with アメリカ

quietone’s picture

Version: 9.4.x-dev » 11.x-dev
Issue summary: View changes
Issue tags: -translation, -locale

Drupal 9 is EOL. Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies.

It would help to have one issue for the discussion. Can you comment on the other issue that this is open? And update the Issue summary with the most recent steps to reproduce. Thanks

achap’s picture

Issue summary: View changes
anybody’s picture

Priority: Normal » Critical

I can confirm this is still happening, as reported by @achap and it's a critical issue for multilanguage sites.
Technically it might make sense to postpone this on #3150540: Configuration langcode is forced to site default language but that would also mean that issue should be seen as a critical fix.

szeidler’s picture

I have a similar problem just the other way around. My interface translations are overwritten by config when I run drush cim

In my case the translation string "Delete" was translated to the Norwegian "Slett" in the "Interface translation". Now I'm doing a drush cim and I'm able to reproduce that the settings.default_delete_button_label from the webform.settings configuration, which has the language: nb (Norwegian) and the English label Delete is overwriting the translation strings.

Can be fixed be changing the webform settings, but I'm quite worried about the side-effects, that a config is overwriting already customized interface translation strings. So whatever I'm overwriting in in "Interface translation", will be in this case overwritten by the webform config.

anybody’s picture

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.