# HG changeset patch # User aronacher # Date 1213792741 0 # Node ID 6d8b42c078bffa238f146beb9cd03224fb74ad4b # Parent 2c0a49081e4b7eaa305fb2d214d53e451cbe5fe8 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)