@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
