Index: l10n_client.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_client/l10n_client.js,v
retrieving revision 1.8
diff -u -r1.8 l10n_client.js
--- l10n_client.js	22 Oct 2008 20:25:33 -0000	1.8
+++ l10n_client.js	19 Jan 2009 18:51:01 -0000
@@ -104,7 +104,7 @@
 
     $('#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 @@
       // 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
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_client/l10n_client.module,v
retrieving revision 1.20
diff -u -r1.20 l10n_client.module
--- l10n_client.module	30 Oct 2008 23:08:22 -0000	1.20
+++ l10n_client.module	19 Jan 2009 18:51:01 -0000
@@ -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.
@@ -251,12 +253,14 @@
  *   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 +282,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 +292,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 +309,8 @@
   foreach ($strings as $values) {
     $source = $values[0] === TRUE ? '' : $values[0];
     $target = $values[1] === TRUE ? '' : $values[1];
-    $output .= "<div><span class='source'>$source</span><span class='target'>$target</span></div>";
+    $textgroup = $values[2];
+    $output .= "<div><span class='source'>$source</span><span class='target'>$target</span><span class='textgroup'>$textgroup</span></div>";
   }
   return "<div id='l10n-client-data'>$output</div>";
 }
@@ -360,6 +365,8 @@
     '#value' => t('Save translation'),
     '#type' => 'submit',
   );
+  // Hidden field for textgroup
+  $form['textgroup'] = array('#type' => 'hidden', '#value' => 'default');
   $form['copy'] = array(
     '#value' => "<input id='edit-copy' class='form-submit' type='button' value='". t('Copy Source') ."'/>",
   );
@@ -393,10 +400,10 @@
   global $user, $language;
   
   if (user_access('use on-page translation')) {
-    if (isset($_POST['source']) && isset($_POST['target']) && !empty($_POST['form_token']) && drupal_valid_token($_POST['form_token'], 'l10n_client_form')) {
+    if (isset($_POST['source']) && isset($_POST['target']) && isset($_POST['textgroup']) && !empty($_POST['form_token']) && drupal_valid_token($_POST['form_token'], 'l10n_client_form')) {
       include_once 'includes/locale.inc';
       $report = array(0, 0, 0);
-      _locale_import_one_string_db($report, $language->language, $_POST['source'], $_POST['target'], 'default', NULL, LOCALE_IMPORT_OVERWRITE);
+      _locale_import_one_string_db($report, $language->language, $_POST['source'], $_POST['target'], $_POST['textgroup'], NULL, LOCALE_IMPORT_OVERWRITE);
       cache_clear_all('locale:', 'cache', TRUE);
       _locale_invalidate_js($language->language);
       
