Index: includes/common.inc
===================================================================
--- includes/common.inc (revision 1278)
+++ includes/common.inc (working copy)
@@ -2300,7 +2300,11 @@
  */
 function drupal_attributes(array $attributes = array()) {
   foreach ($attributes as $attribute => &$data) {
-    $data = implode(' ', (array) $data);
+    if (is_array($data)) {
+      $data = implode(' ', $data);
+    } else {
+      $data = (string)$data;
+    }
     $data = $attribute . '="' . check_plain($data) . '"';
   }
   return $attributes ? ' ' . implode(' ', $attributes) : '';
Index: includes/bootstrap.inc
===================================================================
--- includes/bootstrap.inc  (revision 1278)
+++ includes/bootstrap.inc  (working copy)
@@ -1481,6 +1481,36 @@
   return $obj;
 }
 
+class TString {
+
+  private $string;
+  private $args;
+  private $options;
+
+  final public function init($string, array $args = array(), array $options = array()) {
+    $this->string = $string;
+    $this->args = $args;
+    $this->options = $options;
+  }
+
+  final public function __toString() {
+    return real_t($this->string, $this->args, $this->options);
+  }
+}
+
+function t($string, array $args = array(), array $options = array()) {
+  static $prototype;
+
+  if (null === $prototype) {
+    $prototype = new TString;
+  }
+
+  $t = clone $prototype;
+  $t->init($string, $args, $options);
+
+  return $t;
+}
+
 /**
  * Translates a string to the current language or to a given language.
  *
@@ -1539,7 +1569,7 @@
  * @see format_string()
  * @ingroup sanitization
  */
-function t($string, array $args = array(), array $options = array()) {
+function real_t($string, array $args = array(), array $options = array()) {
   global $language;
   static $custom_strings;
 
Index: includes/form.inc
===================================================================
--- includes/form.inc   (revision 1278)
+++ includes/form.inc   (working copy)
@@ -2673,7 +2673,7 @@
       $options .= form_select_options($element, $choice);
       $options .= '</optgroup>';
     }
-    elseif (is_object($choice)) {
+    elseif (is_object($choice) && !$choice instanceof TString) {
       $options .= form_select_options($element, $choice->option);
     }
     else {
