Skip to content

didrocks/go-gettext

 
 

Repository files navigation

gettext in golang

Build Status

TODO

  • parse mofiles
  • compile plural forms
  • non-utf8 mo files (possible wontfix)
  • gettext
  • ngettext
  • managing mo files / sane API

Example

import gettext

translations := gettext.NewTranslations("path/to/translations/", "messages", gettext.DefaultResolver)

locale := translations.Locale("en")

fmt.Println(locale.Gettext("hello from gettext"))

one := 1
two := 2

fmt.Println(fmt.Sprintf(locale.NGettext("%d thing", "%d things", uint32(one)), one))
fmt.Println(fmt.Sprintf(locale.NGettext("%d thing", "%d things", uint32(two)), two))

About

gettext in golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 97.1%
  • Python 2.9%