Hi
I have problem in module i18n
My locales_source table grows on each request
each day on 200MB. I delete sring table morning each day. My query-"delete from locales_tables where location like '\fr%'";
I try doing 1) from http://drupal.org/node/359249 i stand patch i18strings.patch
Tables grown. No change.
- db_query("INSERT INTO {locales_source} (location, source, textgroup, version) VALUES ('%s', '%s', 'default', '%s')", request_uri(), $string, VERSION);
+ db_query("INSERT INTO {locales_source} (location, source, textgroup, version) VALUES ('%s', '%s', '%s', '%s')", request_uri(), $string, $textgroup, VERSION);
2) I delete 2 string in i18strings.module
//db_query("INSERT INTO {locales_source} (location, source, textgroup, version) VALUES ('%s', '%s', '%s', '%s')", request_uri(), $string, $textgroup, VERSION);
No change. tables grown
I not see where have string "INSERT INTO {locales_source}..." yet in module i18n
i don't undestandt why my base grown

Comments

jeka_fl’s picture

I understood the problem. The problem is not i18n, but a problem in Drupal modules locales
I found strings in module locales.module which translation cached

// If we have the translation cached, skip checking the database
if (!isset($locale_t[$langcode][$string])) {

// We do not have this translation cached, so get it from the DB.
$translation = db_fetch_object(db_query("SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = '%s' WHERE s.source = '%s' AND s.textgroup = 'default'", $langcode, $string));
if ($translation) {
// We have the source string at least.
// Cache translation string or TRUE if no translation exists.
$locale_t[$langcode][$string] = (empty($translation->translation) ? TRUE : $translation->translation);

if ($translation->version != VERSION) {
// This is the first use of this string under current Drupal version. Save version
// and clear cache, to include the string into caching next time. Saved version is
// also a string-history information for later pruning of the tables.
db_query("UPDATE {locales_source} SET version = '%s' WHERE lid = %d", VERSION, $translation->lid);
cache_clear_all('locale:', 'cache', TRUE);
}
}
else {
// We don't have the source string, cache this as untranslated.
//db_query("INSERT INTO {locales_source} (location, source, textgroup, version) VALUES ('%s', '%s', 'default', '%s')", request_uri(), $string, VERSION);
$locale_t[$langcode][$string] = TRUE;
// Clear locale cache so this string can be added in a later request.
cache_clear_all('locale:', 'cache', TRUE);
}
}

An i delete strings db_query("INSERT INTO {locales_source} (location, source, textgroup, version) VALUES ('%s', '%s', 'default', '%s')", request_uri(), $string, VERSION); I base locales_source no grown)))

Marko B’s picture

I also have not so big but 2mb locale_source table with many entries 13,394 would like to cut this down :-)
Is this a bug what you say or is this fixed in latest drupal verrsion?

estone’s picture

Component: Code » Blocks

Hi Jeka_fl,

I had exactly the same problem. I did like you wrote and commented the line, now the database doesn't grow anymore (it's 293 MB).

But... it must be good for something right? Are we missing out on something else now?
Secondly; is it save to empty this table or will it mess up my website? Also the table locales_target. Can I empty this savely?

ehudash’s picture

The slowness of the site is a symptom of the over-sized locales_source table in multilingual sites since it takes a long time to search this massive table for a translation.
Commenting out that line in locale.module will stop the locales_source table from growing but it will also disable the possibility of translating new strings in a multilingual site.

Can someone suggest a solution - one that will allow translations to new string to be made without causing the site to slow to a crawl when searching for a translation from that table?

Clearing locales_source and locales_target will get rid of all translated string of your site, so if you rely on them for your multilingual site, I would not recommend it.
Even clearing only the "untranslated" strings (those in locales_source that have no match in locales_target) won;t do much good, because they will be re-inserted again via the code line mentioned previously ("INSERT INTO...").

joseph.olstad’s picture

Issue summary: View changes
Status: Active » Closed (outdated)