From c89ec44e68e28431a423b4245bcb256c2bb25067 Mon Sep 17 00:00:00 2001 From: crownedgrouse Date: Sat, 25 Mar 2023 11:40:30 +0100 Subject: [PATCH] Document timeago for i18n --- manual/templates-go.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manual/templates-go.md b/manual/templates-go.md index 5c7d1b5..9bcd9ec 100644 --- a/manual/templates-go.md +++ b/manual/templates-go.md @@ -100,11 +100,16 @@ Assists in constructing a HTML checkbox `input` element, eg: Format a date according to the application's default [date](appconf.html#formatdate) and [datetime](appconf.html#formatdatetime) format. +`timeago` accept a second argument (ISO 639-1) as language to be used, otherwise use `i18n.default_language` config value, for preconfigured language : de, fr, ko, pt, sp, tr, zh and default en. +In last resort, internationalisation will apply on timeago english term, and missing translation will be displayed with `i18n.unknown_format` config value. + The example below assumes `dateArg := time.Now()`: {% capture ex %}{% raw %} {{date .MyDate}} {{datetime .MyDateTime}} +{{timeago .MyDateTime}} +{{timeago .MyDateTime "fr"}} {% endraw %}{% endcapture %} {% highlight htmldjango %}{{ex}}{% endhighlight %}