Drupal 8: Reimport all translation files

Published by Lennart Van Vaerenbergh on April 9, 2019

Reimporting all project translation files in Drupal 8 can't be done with a simple click or command. Use the following steps to get it done. Note that all customized translations in your project will not get updated because they are already manually overridden.

The blog post assumes you know how to use SQL queries and Drush commands.

Execute the following query on your Drupal database in order to delete the current translation status of each project (they will get regenerated):
DELETE FROM key_value WHERE collection='locale.translation_status';

Reset the locale_file timestamp and last checked date for all projects:
UPDATE locale_file SET timestamp = 0;
UPDATE locale_file SET last_checked = 0;

Reset the general locale last checked date:
drush ev "\Drupal::state()->set('locale.translation_last_checked', 0);"

Rebuild Drupal cache:
drush cr

Check and update all project translations:
drush locale-check && drush locale-update && drush cr

All projects should be updated now.

In case you want no customized translations (translations added via the Drupal UI Translate Interface), you can reset them before executing the previous commands:
UPDATE locales_target SET customized = 0;
This makes sure every translation gets updated during an import.


Submitted by Peter Krebs on Thursday, June 25, 2020 - 15:38
This worked flawlessly, thanks for posting this

Add new comment

(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.
This challenge is for testing whether or not you are a human visitor and to prevent automated spam submissions.