function _i18nstrings_save_source in Internationalization 5.3
Update locale source and i18n table
1 call to _i18nstrings_save_source()
- i18nstrings_save_string in i18nstrings/
i18nstrings.module - Save string for a language
File
- i18nstrings/
i18nstrings.module, line 237 - Internationalization (i18n) package - translattable strings
Code
function _i18nstrings_save_source(&$source, $update = TRUE) {
// Build location with all the paths this string belongs to
$source->paths = array_unique($source->paths);
$source->location = implode(I18NSTRINGS_SPLIT, $source->paths);
if (!$source->lid) {
// Create locales_source and get new lid
db_query("INSERT INTO {locales_source} (location, source) VALUES ('%s', '%s')", $source->location, $source->source);
$source->lid = db_result(db_query("SELECT lid FROM {locales_source} WHERE location = '%s' AND source = '%s'", $source->location, $source->source));
}
elseif ($update) {
// Update locales source
db_query("UPDATE {locales_source} SET location = '%s', source = '%s' WHERE lid = %d", $source->location, $source->source, $source->lid);
}
// Now update/insert into i18n table
if ($source->strid) {
db_query("DELETE FROM {i18n_locale} WHERE strid = '%s'", $source->strid);
db_query("INSERT INTO {i18n_locale}(strid, lid) VALUES('%s', %d)", $source->strid, $source->lid);
}
}