--- C:/Documents and Settings/John/Bureau/l10n_client-6.x-1.7/l10n_client/l10n_client.module Wed Apr 15 21:10:12 2009 +++ C:/Documents and Settings/John/Bureau/l10n_client.module Sun Aug 16 12:59:20 2009 @@ -163,13 +163,13 @@ if ($display_translated) { $table[] = array(check_plain($data->source), check_plain($data->translation)); if ($allow_translation) { - l10_client_add_string_to_page($data->source, $data->translation); + l10_client_add_string_to_page($data->source, $data->translation, $textgroup); } } else { $table[] = array(check_plain($data->source)); if ($allow_translation) { - l10_client_add_string_to_page($data->source, TRUE); + l10_client_add_string_to_page($data->source, TRUE, $textgroup); } } } @@ -196,8 +196,10 @@ if (user_access('use on-page translation') && ($page_strings = _l10n_client_page_strings())) { // If we have strings for the page language, restructure the data. $l10n_strings = array(); - foreach ($page_strings as $string => $translation) { - $l10n_strings[] = array($string, $translation); + foreach ($page_strings as $textgroup => $group_strings) { + foreach ($group_strings as $string => $translation) { + $l10n_strings[] = array($string, $translation, $textgroup); + } } array_multisort($l10n_strings); // Include string selector on page. @@ -252,11 +254,11 @@ * @param $translation * Translation string. TRUE if untranslated. */ -function l10_client_add_string_to_page($source = NULL, $translation = NULL) { +function l10_client_add_string_to_page($source = NULL, $translation = NULL, $textgroup = 'default') { static $strings = array(); if (isset($source)) { - $strings[$source] = $translation; + $strings[$textgroup][$source] = $translation; } else { return $strings; @@ -279,7 +281,8 @@ // If this is not the module's translation page, merge all strings used on the page. if (arg(0) != 'locale' && is_array($locale = locale()) && isset($locale[$language->language])) { - $strings = array_merge($strings, $locale[$language->language]); + $strings += array('default' => array()); + $strings['default'] = array_merge($strings['default'], $locale[$language->language]); // Also select and add other strings for this path. Other users may have run // into these strings for the same page. This might be useful in some cases @@ -288,8 +291,8 @@ // path. $result = db_query("SELECT s.source, t.translation FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = '%s' WHERE s.location = '%s'", $language->language, request_uri()); while ($data = db_fetch_object($result)) { - if (!array_key_exists($data->source, $strings)) { - $strings[$data->source] = (empty($data->translation) ? TRUE : $data->translation); + if (!array_key_exists($data->source, $strings['default'])) { + $strings['default'][$data->source] = (empty($data->translation) ? TRUE : $data->translation); } } } @@ -305,7 +308,8 @@ foreach ($strings as $values) { $source = $values[0] === TRUE ? '' : htmlspecialchars($values[0], ENT_NOQUOTES, 'UTF-8'); $target = $values[1] === TRUE ? '' : htmlspecialchars($values[1], ENT_NOQUOTES, 'UTF-8'); - $output .= "