Index: l10n_client.js =================================================================== --- l10n_client.js (revision 7) +++ l10n_client.js (working copy) @@ -104,7 +104,7 @@ Drupal.behaviors.l10nClient = function ( $('#l10n-client-string-editor .source-text').text(Drupal.l10nClient.getString(index, 'source')); $('#l10n-client-form #edit-target').val(Drupal.l10nClient.getString(index, 'target')); - + $('#l10n-client-form #edit-textgroup').val(Drupal.l10nClient.getString(index, 'textgroup')); Drupal.l10nClient.selected = index; }); @@ -151,6 +151,7 @@ Drupal.behaviors.l10nClient = function ( // Send source and target strings. data: 'source=' + Drupal.encodeURIComponent($('#l10n-client-string-editor .source-text').text()) + '&target=' + Drupal.encodeURIComponent($('#l10n-client-form #edit-target').val()) + + '&textgroup=' + Drupal.encodeURIComponent($('#l10n-client-form #edit-textgroup').val()) + '&form_token=' + Drupal.encodeURIComponent($('#l10n-client-form #edit-l10n-client-form-form-token').val()), success: function (data) { // Store string in local js Index: l10n_client.module =================================================================== --- l10n_client.module (revision 7) +++ l10n_client.module (working copy) @@ -163,13 +163,13 @@ function l10n_client_translate_page($dis 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,9 +196,12 @@ function l10n_client_footer() { 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); + } } + xdebug_break(); array_multisort($l10n_strings); // Include string selector on page. $string_list = _l10n_client_string_list($l10n_strings); @@ -251,12 +254,14 @@ function l10n_client_footer() { * Source string or NULL if geting the list of strings specified. * @param $translation * Translation string. TRUE if untranslated. + * @param $textgroup + * Text group the string belongs to */ -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; @@ -278,8 +283,8 @@ function _l10n_client_page_strings() { // 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 +293,8 @@ function _l10n_client_page_strings() { // 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 +310,9 @@ function _l10n_client_dom_strings($strin 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 .= "