Skip to content

Commit

Permalink
Document timeago for i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
crownedgrouse committed Mar 25, 2023
1 parent 294d8ff commit c89ec44
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions manual/templates-go.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down

0 comments on commit c89ec44

Please sign in to comment.