How to handle i18n in Go?
I searched on web but I didn't find anything related to i18n and Go.
I wish to use Go for develop web sites. What is the best way to handle internationalization?
go-i18n has some nice features:
- Implements CLDR plural rules.
- Uses text/template for strings with variables.
- Translation files are simple JSON.
Comprehensive support for international text. Support for international dates, times, etc. Support for multilingual messages.
As you can see from the Go Roadmap, Go doesn't provide full i18n support yet.
The new template package allows you to at add a function to template's function map, that would transform the given string to a localized version. What's going on underneath would be up to you for now, as the language choice could be based on headers sent by the browser.
That's a very basic use case for adding localized messages in a web app, for one.
Can't wait for the proper support for internationalization, local date and time formats.