Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ i18n Public

Package i18n is a middleware that provides internationalization and localization for Flamego

License

Notifications You must be signed in to change notification settings

flamego/i18n

Repository files navigation

i18n

GitHub Workflow Status GoDoc

Package i18n is a middleware that provides internationalization and localization for Flamego.

Installation

go get github.com/flamego/i18n

Getting started

# locales/locale_en-US.ini
greeting = How are you?
# locales/locale_zh-CN.ini
greeting = 你好吗?
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

License

This project is under the MIT License. See the LICENSE file for the full license text.

About

Package i18n is a middleware that provides internationalization and localization for Flamego

Topics

Resources

License

Stars

Watchers

Forks

Contributors 5

Languages

AltStyle によって変換されたページ (->オリジナル) /