Skip to content

Commit c89ec44

Browse files
committed
Document timeago for i18n
1 parent 294d8ff commit c89ec44

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

manual/templates-go.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,16 @@ Assists in constructing a HTML checkbox `input` element, eg:
100100

101101
Format a date according to the application's default [date](appconf.html#formatdate) and [datetime](appconf.html#formatdatetime) format.
102102

103+
`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.
104+
In last resort, internationalisation will apply on timeago english term, and missing translation will be displayed with `i18n.unknown_format` config value.
105+
103106
The example below assumes `dateArg := time.Now()`:
104107

105108
{% capture ex %}{% raw %}
106109
{{date .MyDate}}
107110
{{datetime .MyDateTime}}
111+
{{timeago .MyDateTime}}
112+
{{timeago .MyDateTime "fr"}}
108113
{% endraw %}{% endcapture %}
109114
{% highlight htmldjango %}{{ex}}{% endhighlight %}
110115

0 commit comments

Comments
 (0)