--- old_i18nstrings.module	2010-05-07 23:35:58.000000000 +0000
+++ new_i18nstrings.module	2010-06-01 13:16:04.000000000 +0000
@@ -261,18 +261,8 @@
   if ($update) {
     i18nstrings_update_string($name, $string);
   }
-  // if language is default look in sources table
-  if (i18nstrings_translate_langcode($langcode)) {
-    $translation = i18nstrings_get_string($name, $langcode);
-  }
-  if (!$translation) {
-    if ($source = i18nstrings_get_source($name)) {
-      $translation = $source->source;
-    }
-    else {
-      $translation = '';
-    }
-  }
+
+  $translation = i18nstrings_translate_string($name, $string, $langcode);
   return $translation;
 }
 
@@ -1095,11 +1085,28 @@
 function i18nstrings_text($name, $default, $langcode = NULL) {
   global $language;
   $langcode = $langcode ? $langcode : $language->language;
+
+  $context = i18nstrings_context($name, $default);
+
   // If language is default or we don't have translation, just return default string
   if (i18nstrings_translate_langcode($langcode) && ($translation = i18nstrings_get_translation($name, $langcode))) {
-    return check_markup($translation->translation, $translation->format, FALSE);
+    $translation = check_markup($translation->translation, $translation->format, FALSE);
   }
-  return $default;
+   else {
+    $translation = $default;
+  }
+
+  // If not default language and l10n_client in enabled
+  if (language_default('language') == $langcode && $language->language == $langcode && function_exists('l10_client_add_string_to_page')) {
+    // Aditional checking for input format, if its a dangerous one we ignore the string
+    if (empty($source)) {
+      $source = i18nstrings_get_source($context, $default);
+    }
+    if ($source && i18nstrings_allowed_format($source->format) || filter_access($source->format)) {
+      l10_client_add_string_to_page($default, $translation, $source->textgroup);
+    }
+  }
+  return $translation;
 }
 
 /**
