Index: /trunk/roundcubemail/program/include/rcube_template.php
===================================================================
--- /trunk/roundcubemail/program/include/rcube_template.php	(revision 4824)
+++ /trunk/roundcubemail/program/include/rcube_template.php	(revision 4825)
@@ -36,4 +36,5 @@
     private $message = null;
     private $js_env = array();
+    private $js_labels = array();
     private $js_commands = array();
     private $object_handlers = array();
@@ -231,5 +232,5 @@
 
         foreach ($args as $name) {
-            $this->command('add_label', $name, rcube_label($name));
+            $this->js_labels[$name] = rcube_label($name);
         }
     }
@@ -267,4 +268,5 @@
         $this->env = array();
         $this->js_env = array();
+        $this->js_labels = array();
         $this->js_commands = array();
         $this->object_handlers = array();
@@ -452,4 +454,7 @@
         if (!$this->framed && !empty($this->js_env)) {
             $out .= JS_OBJECT_NAME . '.set_env('.json_serialize($this->js_env).");\n";
+        }
+        if (!empty($this->js_labels)) {
+            $this->command('add_label', $this->js_labels);
         }
         foreach ($this->js_commands as $i => $args) {
Index: /trunk/roundcubemail/program/js/app.js
===================================================================
--- /trunk/roundcubemail/program/js/app.js	(revision 4824)
+++ /trunk/roundcubemail/program/js/app.js	(revision 4825)
@@ -71,7 +71,10 @@
 
   // add a localized label to the client environment
-  this.add_label = function(key, value)
-  {
-    this.labels[key] = value;
+  this.add_label = function(p, value)
+  {
+    if (typeof p == 'string')
+      this.labels[p] = value;
+    else if (typeof p == 'object')
+      $.extend(this.labels, p);
   };
 
