diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2008-06-18 12:39:01 +0000 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2008-06-18 12:39:01 +0000 |
commit | 81d791957573f2c57134298fbab2915b7e95c94d (patch) | |
tree | 2aa361a547b2b707184e7a22e8038ed552093d6f /contrib | |
parent | 3bb4ceb6af2b3c2924f79c0cf4f5c689450978b7 (diff) | |
download | babel-81d791957573f2c57134298fbab2915b7e95c94d.tar.gz |
Added documentation to format method in babel.js
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/babel.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/babel.js b/contrib/babel.js index 8632000..fb2fbb4 100644 --- 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 @@ var babel = new function() { } }; + /** + * 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) |