]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
doc: Enhance doc about format strings in JavaScript.
authorBruno Haible <bruno@clisp.org>
Sun, 8 Sep 2024 08:02:23 +0000 (10:02 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 8 Sep 2024 15:28:36 +0000 (17:28 +0200)
* gettext-tools/doc/lang-javascript.texi (JavaScript): Document how to get a
decent 'format' method.

gettext-tools/doc/lang-javascript.texi

index 21b1ea79428f292fa9df0177f1b1590fbd76b00d..c678725ec8d0ee719aa85362f884f61a60cd2655 100644 (file)
@@ -1,5 +1,5 @@
 @c This file is part of the GNU gettext manual.
-@c Copyright (C) 1995-2020 Free Software Foundation, Inc.
+@c Copyright (C) 1995-2024 Free Software Foundation, Inc.
 @c See the file gettext.texi for copying conditions.
 
 @node JavaScript
@@ -52,7 +52,14 @@ use, or emulate
 @code{xgettext}
 
 @item Formatting with positions
----
+A @code{format} method on strings can be used.
+But since it is not standard in JavaScript,
+you have to enable it yourself, through
+
+@example
+const Format = imports.format;
+String.prototype.format = Format.format;
+@end example
 
 @item Portability
 On platforms without gettext, the functions are not available.