Skip to content

Commit a1617fb

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

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

manual/templates-go.md

+6
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,17 @@ 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, either string or variable set in `ViewArgs` telling (ISO 639-1 code) 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"}}
113+
{{timeago .MyDateTime .lang}}
108114
{% endraw %}{% endcapture %}
109115
{% highlight htmldjango %}{{ex}}{% endhighlight %}
110116

0 commit comments

Comments
 (0)