function _i18nstrings_get_source in Internationalization 5.3
Get source string from locale system
Parameters
$string: String in the default language
$strid: String id
1 call to _i18nstrings_get_source()
- i18nstrings_save_string in i18nstrings/
i18nstrings.module - Save string for a language
File
- i18nstrings/
i18nstrings.module, line 215 - Internationalization (i18n) package - translattable strings
Code
function _i18nstrings_get_source($string, $strid = NULL) {
$source = NULL;
// First try with string id using i18n_locale
if ($strid) {
$source = db_fetch_object(db_query("SELECT i.*, s.source, s.location FROM {i18n_locale} i LEFT JOIN {locales_source} s ON i.lid = s.lid WHERE strid = '%s'", $strid));
}
if (!$source && $string) {
// Retry with the string itself using the locales_source table
$source = db_fetch_object(db_query("SELECT s.* FROM {locales_source} s WHERE s.source = '%s'", $string));
}
if ($source) {
// This will let us know how many object elements use this source string
// If location is empty (may happen when imported strings, the array should countain one empty string)
$source->paths = explode(I18NSTRINGS_SPLIT, $source->location);
}
return $source;
}