1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-26 05:15:56 +00:00

example: i18n: nested .ini template key-values

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-09-14 22:00:20 +03:00
parent 44d5ebdc9c
commit 0f7cf7f35c
5 changed files with 43 additions and 3 deletions

View File

@@ -46,7 +46,10 @@ func newApp() *iris.Application {
}
}
app.I18n.Load("./locales/*/*", "en-US", "el-GR")
err := app.I18n.Load("./locales/*/*", "en-US", "el-GR")
if err != nil {
panic(err)
}
app.Get("/", func(ctx iris.Context) {
text := ctx.Tr("HiDogs", iris.Map{
@@ -69,5 +72,11 @@ func newApp() *iris.Application {
ctx.WriteString(text)
})
// showcases the other.ini translation file.
app.Get("/other", func(ctx iris.Context) {
ctx.Writef(`AccessLogClear: %s
Title: %s`, ctx.Tr("debug.AccessLogClear"), ctx.Tr("user.connections.Title"))
})
return app
}