How do you bulk delete bad strings from the translation tables?

Hiveminds - January 18, 2007 - 16:37

I know you can remove a string one at a time through the admin section. But what if you want to bulk delete? Since strings are stored in binary blobs there is no way of selecting them by characteristic. Using the lid is the only way.

So what happens if you just want to empty a table a start from scratch? would anything fail?

by "bad" do you mean untranslated strings?

christefano - April 14, 2008 - 09:19

I was wondering about this, too, and found this post.

On one site I had 12000 strings in locale.module but only 100 or so were actually translated. This is pretty ridiculous, so I exported the strings as a translation and then edited it in vi. I tried something like :/msgstr/-3 | :d 4 to just get the msgstr's.

Then I used String Overrides to replace the strings without the overhead of locale.module.

Well what I meant was if

Hiveminds - April 14, 2008 - 12:55

Well what I meant was if someone make a mistake in the translation that was global. Like they did translations for the word "edit" which appears in 2000 different strings. Normally I would do a SQL search and replace for the word and substitute the new translated word. But storage of strings in a blob prevents this.

Hiveminds Magazine | FireOrb | Drupal Street | Drupal offline manual

That isn't how locale.module works

christefano - April 19, 2008 - 07:19

This isn't how locale.module works. It will determine the path that where the string appears and only translate that instance.

Right, but going behind

Hiveminds - April 19, 2008 - 16:53

Right, but going behind someone that made a mistake in translating one word in 1000 path instances means going back and doing each one seperately. There should be a batch update.

Hiveminds Magazine | FireOrb | Drupal Street | Drupal offline manual

Ah, I understand now

christefano - April 19, 2008 - 23:58

That's a bad deal you've been dealt, my friend. This sounds like a question for the Translations mailing list.

It may be possible that you can use something like the iMacros extension and automate a bulk delete by hitting your site with URLs like like http://dev.localhost/admin/settings/locale/string/delete/185

I'm also keen to know the

alleyoopster - April 25, 2008 - 03:28

I'm also keen to know the answer here. I imported the wrong .po file into menu and now I have translations that I would like to delete. One by one would be too time consuming. I tried deleting in the database, but I didn't get very far. I am happy to delete the whole translations rather than just a string, so this maybe easier.

Hi, you can go to Administer

drupalbg - May 4, 2008 - 22:53

Hi, you can go to Administer -> Site Building -> Translate Interface (if you do not find it in menu, may be you need to enable the module)
There you export the current translation.
On your local computer replace the word that annoys you.
Then import the translation .po file back.

Nice reply, thanks!

Hiveminds - May 5, 2008 - 17:07
 
 

Drupal is a registered trademark of Dries Buytaert.