Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document timeago for i18n #212

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions manual/templates-go.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,17 @@ 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, 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.
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"}}
{{timeago .MyDateTime .lang}}
{% endraw %}{% endcapture %}
{% highlight htmldjango %}{{ex}}{% endhighlight %}

Expand Down
2 changes: 1 addition & 1 deletion tutorial/gettingstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Git and Mercurial are required to allow `go get` to clone various dependencies.

To get the Revel framework, run

go get github.com/revel/revel
go install github.com/revel/cmd/revel@latest

This command does a couple of things:

Expand Down