https://github.com/flamego/i18n
Package i18n is a middleware that provides internationalization and localization for Flamego
https://github.com/flamego/i18n
flamego go i18n internalization l10n localization middleware
Last synced: about 1 month ago
JSON representation
Package i18n is a middleware that provides internationalization and localization for Flamego
- Host: GitHub
- URL: https://github.com/flamego/i18n
- Owner: flamego
- License: mit
- Created: 2021-09-09T14:55:58.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-08-03T19:15:53.000Z (7 months ago)
- Last Synced: 2025-08-03T19:34:38.357Z (7 months ago)
- Topics: flamego, go, i18n, internalization, l10n, localization, middleware
- Language: Go
- Homepage:
- Size: 86.9 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# i18n
[](https://github.com/flamego/i18n/actions?query=workflow%3AGo)
[](https://pkg.go.dev/github.com/flamego/i18n?tab=doc)
Package i18n is a middleware that provides internationalization and localization for [Flamego](https://github.com/flamego/flamego).
## Installation
```zsh
go get github.com/flamego/i18n
```
## Getting started
```ini
# locales/locale_en-US.ini
greeting = How are you?
```
```ini
# locales/locale_zh-CN.ini
greeting = 你好吗?
```
```go
package main
import (
"github.com/flamego/flamego"
"github.com/flamego/i18n"
)
func main() {
f := flamego.Classic()
f.Use(i18n.I18n(
i18n.Options{
Languages: []i18n.Language{
{Name: "en-US", Description: "English"},
{Name: "zh-CN", Description: "简体中文"},
},
},
))
f.Get("/", func(l i18n.Locale) {
message := l.Translate("greeting")
// ...
})
f.Run()
}
```
## Getting help
- Read [documentation and examples](https://flamego.dev/middleware/i18n.html).
- Please [file an issue](https://github.com/flamego/flamego/issues) or [start a discussion](https://github.com/flamego/flamego/discussions) on the [flamego/flamego](https://github.com/flamego/flamego) repository.
## License
This project is under the MIT License. See the [LICENSE](LICENSE) file for the full license text.