This is a follow-up from http://drupal.org/node/171646, where I explained the background about locale tables being full of outdated garbage. We already solved most of my proposals for D6 in that issue, including removal of untranslated strings at the time of major-version upgrade (which should be repeated for D7 probably), and simple registering of string-history, VERSION-wise, resulting in reduced cache load.

Now I start this issue to implement the last of my proposals: UI allowing the admin to prune locale tables.

It's based on data already collected 'behind the scene' by the previously added code, and provides simply an overview of strings, divided into groups by Drupal version of last use, textgroup, and (un)translated status. Each item offers it's own 'delete' link (with the common 'Are you sure?' confirmation of course), so equipped with a matching help-text, the page allows admin to identify and prune old garbage easily. Additionally, the VERSION-history field is added to the Translate interface search-screen.

The purpose is both performance (reducing table sizes) and usability (keeping translation-work sane, especially by reducing irrelevant search results, and avoiding pointless dead-strings translation generally); the whole applies especially to long standing localized sites, with a few updates already done.

The patch is now against D6, as there's no D7 code yet - currently it works, but I created it just to have some basic version, my ideas written down, as a starting point for future D7 version. Attaching only for reference.

Issue fork drupal-175798

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

JirkaRybka’s picture

StatusFileSize
new37.35 KB

Adding screenshot from a working instance (D6) on a test-install using real site's data. Might explain a bit more, if you prefer visual input. :-)

bas.hr’s picture

subscribing

meba’s picture

subscribing

nedjo’s picture

Issue tags: +i18n sprint
catch’s picture

Title: D7: Locales pruning UI » UI for pruning dead locale strings
Version: 7.x-dev » 8.x-dev
Category: feature » task

This is great idea which we sadly missed for Drupal 7, moving up a version.

kscheirer’s picture

Title: UI for pruning dead locale strings » UI for pruning dead locale strings and displaying version
Version: 8.x-dev » 7.x-dev
Category: task » bug

This really needs to get in soon. I'm not sure when we introduced VERSIONs to locale strings exactly - but when working with older sites its almost impossible to find the "correct" string to translate. The only way to tell which version a string is tagged with is by looking at the database rows directly.

This seems like a bug to me - 7's release is just going to make this problem worse - and as far as I know this issue isn't documented anywhere. We need this interface to properly use localized strings. I would say we need a backport to 6 as well.

kscheirer’s picture

Title: UI for pruning dead locale strings and displaying version » UI for pruning dead locale strings
Version: 7.x-dev » 8.x-dev
Category: bug » task

Ok, pruning does need to go in, but its not critical by itself. Setting this issue back to where it was, and opened #993820: UI for locale string versions

Adding this information to the UI when searching for strings and the resulting table of results is absolutely critical - we can't hide that data from admins.

JirkaRybka’s picture

Assigned: JirkaRybka » Unassigned

The VERSION was introduced in 6.x (my patch) for the purpose of later pruning. My site had a bazillion of dead strings due to 5.x (I think) change of all t() placeholders, but not only... But since I came into the core development a bit late (code freeze), the maximum I managed was just recording VERSION, so that the pruning code (to be added later) already have the needed strings-history data. In fact, it probably only got in because it also helps performance by reducing locale cache size (currently the only real use for VERSION data).

I did a proof-of-concept pruning UI at the same time (initial post here), but it contains some MySQL-specific stuff, and was obviously too late for 6.x. I'm sure several people would suggest to release this as a contributed module, but I don't want to do that because:
1. If this was a separate module, no-one would ever care to find it and install it, so the root of the problem won't be really fixed.
2. If this was a separate module, it won't get considered as a patch for core again.
3. I'll be stuck maintaining it forever.

As much as I wanted to re-open this for 7.x and finish my work, my time was more and more limited, and my testing environment got incompatible with 7.x (being primarily a testing environment for production site changes, so upgrade wasn't desirable), locking me out of development somehow. Now with DBTNG and all the new stuff, getting up to speed again is beyond my free time possibilities.

So all I can do for now, is unassign myself (should've done long ago, only just forgot). Sorry for that.

kscheirer’s picture

No worries, that happens all the time. I would definitely appreciate a review on #993820: UI for locale string versions though, and then I'll see if I can get a patch for the pruning part too.

kscheirer’s picture

StatusFileSize
new9.6 KB

Posting an interim patch, updating JirkaRybka's original patch to HEAD.

I have the main prune table displaying, but the confirm form doesn't work yet. Not sure how thats changed in D7. I probably won't have any more time for a bit, so anyone feel free to add to it :)

JirkaRybka’s picture

You'll probably need to replace the cool but sadly just MySQL specific SQL "DELETE s FROM {locales_source} s LEFT JOIN {locales_target} ....." with something else, most probably a subquery like "DELETE FROM {locales_source} WHERE lid NOT IN(SELECT lid FROM .... JOIN ....)". I'm not sure how this is done in 7.x, and how it's going to perform, though.

Also I remeber adding an update function to 6.x, to delete all untranslated strings on 6.0 upgrade - untranslated strings are safe to remove, reducing the tables a bit in size. This needs to be repeated on 7.x (and every major version upgrade), not sure whether somebody already added it... (Original issue #171646: Performance: Locales pruning, where I learned my lesson about MySQL specific stuff as well, one of my very first ones for core.)

Just trying to provide random bits I remember from the initial patch time, like I said, I'm not really up-to-date now.

gábor hojtsy’s picture

I think it is dangerous to do pruning based on this information, as it might remove important translations for say error messages, which are not displayed often, but would be pretty important to display in the right language when used. I'd suggest people use potx maybe cross-referenced with this information to make sure they actually remove strings which are even less likely to be needed. Not sure this should be done just based on the version info core has.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

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

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

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.

andypost’s picture

Version: 9.4.x-dev » 10.1.x-dev
Category: Task » Feature request

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

anybody’s picture

Issue tags: +Performance

I think we fixed this in contrib with https://www.drupal.org/project/l10n_tools

Still it would be great to have this feature in core, if maintainers like it. We're open to improve and integrate the functionality. Until then simply use https://www.drupal.org/project/l10n_tools and help pushing things forward :)

Adding "Performance" tag like according to the issue summary.

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.

meeni_dhobale made their first commit to this issue’s fork.