Description
gotext is a Go package that implements the GNU gettext utilities natively, so Go applications can translate their text without calling external tools. It is for internationalization and localization: you load PO or MO translation files and look up translated strings at run time. The core library has no external dependencies and is described as thread-safe for concurrent use. It supports plural forms through GNU gettext plural-form expressions, message contexts through msgctxt, and UTF-8 by default. Results are plain strings, so they work directly in Go's text/template and html/template pipelines. Locale objects let you manage several languages or domains separately, and serializable objects can be cached. A command-line tool called xgotext extracts translatable strings from Go source into .pot template files, which you then merge into language-specific .po files. The README links to a full documentation site with a getting started guide, the xgotext guide, a plural forms guide and a directory structure guide. The project is public on GitHub.…
Highlights
- Native Go implementation of GNU gettext
- PO and MO file support
- Plural forms and message contexts
- Thread-safe with no external dependencies
- xgotext tool extracts strings from Go source
Ratings & Reviews
No ratings yet
Be the first to rate Gotext.
People also visit
Gotext FAQ
What is gotext?
A Go package that implements GNU gettext, used to translate strings in Go applications.
How do I install it?
Add the Go package to your project as shown in the README installation section. The xgotext CLI is installed separately.
How do I extract strings to translate?
Run xgotext on your Go source to create .pot templates, then merge them into language-specific .po files.
Does it support plurals?
Yes. It handles plural forms defined in PO headers using GNU gettext expressions.
Is it safe to use from several goroutines?
Yes. The README describes the package as thread-safe for concurrent use.
What are the best Gotext alternatives?
Popular alternatives to Gotext include Go I18n, gettext + iconv and Poedit. See all Gotext alternatives



