gotext
GNU gettext utilities for Go.
gotext is a native Go implementation of the GNU Gettext utilities. It provides a thread-safe, flexible, and powerful way to handle internationalization (i18n) and localization (l10n) in your Go applications.
Why use gotext?
- Native Go: The core library has no external dependencies and requires no CGO.
- Thread-safe: Designed for concurrent use in web servers and high-performance apps.
- Gettext Compatible: Supports standard
.poand.mofiles, including complex plural forms and contexts. - CLI Support: Includes
xgotextto automate the extraction of strings from your source code.
Guides
- Getting Started — install, first app, and the
Localeobject. - Plural Forms — complex pluralization rules.
- xgotext CLI — extract translatable strings from your source code.
- Character Encoding — UTF-8 handling and legacy encodings.
- Advanced Usage —
embed.FS, named formatting, caching, custom backends. - Best Practices — keep your translations maintainable.
Quick Links
Contributing
We welcome contributions! Please see our Contributing Guidelines and Code of Conduct.