class Marten::Template::Tag::Localize
- Marten::Template::Tag::Localize
- Marten::Template::Tag::Base
- Reference
- Object
Overview
The localize
template tag.
The localize
template tag allows performing localization on values such as dates, numbers, and times
within templates. It can take one mandatory argument (the value to localize) and an optional format
keyword argument to specify a localization format.
Usage examples:
{% localize created_at %}
{% localize 100000 format: "short" %}
The format
argument must match a key defined in the locale file.
Optionally, the result of the localization can be assigned to a variable using as
keyword:
{% localize created_at format: "short" as localized_date %}
Included Modules
Defined in:
marten/template/tag/localize.crConstructors
Instance Method Summary
-
#render(context : Context) : String
Render the template tag for a given context.
Instance methods inherited from module Marten::Template::Tag::CanSplitSmartly
split_smartly(expression : String) : Array(String)
split_smartly
Instance methods inherited from module Marten::Template::Tag::CanExtractKwargs
extract_kwargs(source : String)
extract_kwargs
Instance methods inherited from class Marten::Template::Tag::Base
render(context : Context) : String
render
Constructor methods inherited from class Marten::Template::Tag::Base
new(parser : Parser, source : String)
new
Constructor Detail
Instance Method Detail
Description copied from class Marten::Template::Tag::Base
Render the template tag for a given context.