mirror of
https://github.com/kataras/iris.git
synced 2026-01-05 03:07:38 +00:00
i18n: add 'tr' template function inside the translation files themselves
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
Dog: "σκυλί"
|
||||
HiDogs: Γειά {{plural (tr .locale "Dog") .count }}
|
||||
HiDogs: Γειά {{plural (tr "Dog") .count }}
|
||||
@@ -1,2 +1,2 @@
|
||||
Dog: "dog"
|
||||
HiDogs: Hi {{plural (tr .locale "Dog") .count }}
|
||||
HiDogs: Hi {{plural (tr "Dog") .count }}
|
||||
@@ -32,8 +32,7 @@ func newApp() *iris.Application {
|
||||
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
text := ctx.Tr("HiDogs", iris.Map{
|
||||
"locale": ctx.GetLocale(),
|
||||
"count": 2,
|
||||
"count": 2,
|
||||
}) // prints "Hi 2 dogs".
|
||||
ctx.WriteString(text)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user