# HG changeset patch # User aronacher # Date 1213792741 0 # Node ID 87a95f81714524b1c382fa60aef54f8e9a315de6 # Parent 8ad7a924f1ca6aa22c64d97fd49e0c536cc85e2a Added documentation to format method in babel.js diff --git a/contrib/babel.js b/contrib/babel.js --- 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)