function i18nstrings_admin_update in Internationalization 6
Update strings for language.
1 call to i18nstrings_admin_update()
- i18nstrings_admin_refresh_submit in i18nstrings/
i18nstrings.admin.inc - Form submission.
File
- i18nstrings/
i18nstrings.admin.inc, line 85 - Admin page callbacks for the i18nstrings module.
Code
function i18nstrings_admin_update($language, $groups) {
$params = $groups;
$params[] = $language;
$sql = 'SELECT g.*, t.translation, t.lid as tlid, i.format FROM {locales_source} g INNER JOIN {locales_source} s ON g.source = s.source AND s.lid <> g.lid ';
$sql .= 'INNER JOIN {locales_target} t ON s.lid = t.lid LEFT JOIN {locales_target} t2 ON g.lid = t2.lid ';
$sql .= 'INNER JOIN {i18n_strings} i ON i.lid = g.lid ';
$sql .= 'WHERE t2.lid IS NULL AND g.textgroup IN (' . db_placeholders($groups, 'varchar') . ") AND t.language = '%s'";
$result = db_query($sql, $params);
$count = 0;
while ($string = db_fetch_object($result)) {
// Just update strings when no input format, otherwise it could be dangerous under some circumstances.
if (empty($string->format) && !empty($string->translation)) {
$count++;
db_query("INSERT INTO {locales_target} (translation, lid, language) VALUES('%s', %d, '%s')", $string->translation, $string->lid, $language);
}
}
return $count;
}