Home

textdomain

Textdomain is a label used in software internationalization to identify a specific collection of translated strings, stored in a translation catalog. The domain name corresponds to the filename portion of translation files (such as PO and MO files) and is used by translation functions to fetch the correct localized text for a given language. The domain helps organize translations by component, module, or project.

In PHP's gettext implementation, the translation process relies on functions like bindtextdomain and textdomain. Bindtextdomain(domain, directory)

Beyond PHP, the concept appears in other ecosystems that use gettext-style tooling, including content management systems

specifies
where
to
find
the
catalog
for
a
given
domain,
while
textdomain(domain)
sets
the
default
domain
for
subsequent
calls
to
translation
functions
such
as
gettext(),
_,
and
ngettext().
Translation
files
are
typically
organized
under
locale/<language>/LC_MESSAGES/<domain>.mo,
with
the
corresponding
human-readable
PO
files
used
during
development.
If
no
domain
is
set,
a
fallback
domain
such
as
"messages"
may
be
used
by
some
environments,
though
behavior
varies
by
platform.
and
frameworks.
In
these
contexts,
a
textdomain
often
corresponds
to
a
particular
component
(for
example,
a
plugin
or
theme)
and
is
used
when
loading
translations
or
when
calling
translation
helpers
like
__()
or
_e()
with
an
explicit
domain.
Correctly
naming,
loading,
and
referencing
the
domain
ensures
that
translations
are
isolated,
correctly
localized,
and
not
mixed
across
components.