changeset 365:87a95f817145

Added documentation to format method in babel.js
author aronacher
date Wed, 18 Jun 2008 12:39:01 +0000
parents 8ad7a924f1ca
children 1cc8aba0363e
files contrib/babel.js
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/babel.js
+++ b/contrib/babel.js
@@ -29,7 +29,7 @@
  *
  * Missing elements in the object are ignored.
  *
- * Typical usage:
+ * Typical usage::
  *
  *    var translations = babel.Translations.load(...).install();
  */
@@ -129,6 +129,16 @@
     }
   };
 
+  /**
+   * A python inspired string formatting function.  Supports named and
+   * positional placeholders and "s", "d" and "i" as type characters
+   * without any formatting specifications.
+   *
+   * Examples::
+   *
+   *    babel.format(_('Hello %s'), name)
+   *    babel.format(_('Progress: %(percent)s%%'), {percent: 100})
+   */ 
   this.format = function() {
     var arg, string = arguments[0], idx = 0;
     if (arguments.length == 1)
Copyright (C) 2012-2017 Edgewall Software