1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
@c This file is part of the GNU gettext manual.
@c Copyright (C) 1995-2024 Free Software Foundation, Inc.
@c See the file gettext.texi for copying conditions.
@node JavaScript
@subsection JavaScript
@table @asis
@item RPMs
js
@item Ubuntu packages
gjs
@item File extension
@code{js}
@item String syntax
@itemize @bullet
@item @code{"abc"}
@item @code{'abc'}
@item @code{`abc`}
@c https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
@item @code{@var{tag}`abc$@{@var{expression}@}def@{@var{expression}@}...`},
see the description of @samp{--tag} in @ref{xgettext Invocation}.
@end itemize
@item gettext shorthand
@code{_("abc")}
@item gettext/ngettext functions
@code{gettext}, @code{dgettext}, @code{dcgettext}, @code{ngettext},
@code{dngettext}
@item textdomain
@code{textdomain} function
@item bindtextdomain
@code{bindtextdomain} function
@item setlocale
automatic
@item Prerequisite
---
@item Use or emulate GNU gettext
use, or emulate
@item Extractor
@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.
@item po-mode marking
---
@end table
|