class Marten::Template::Tag::Translate

Overview

The translate template tag.

The translate template tag allows to perform translation lookups by using the I18n configuration of the project. It must take at least one argument (the translation key) followed by keyword arguments. For example the following lines are valid usages of the translate tag:

{% translate "simple.translation" %}
{% translate "simple.interpolation" value: 'test' %}

Translation keys and parameter values can be resolved as template variables too, but they can also be defined as literal values if necessary.

Optionally, resolved translations can be assigned to a specific variable using the as keyword:

{% translate "simple.interpolation" value: 'test' as my_var %}

Included Modules

Defined in:

marten/template/tag/translate.cr

Constructors

Instance Method Summary

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

def self.new(parser : Parser, source : String) #

[View source]

Instance Method Detail

def render(context : Context) : String #
Description copied from class Marten::Template::Tag::Base

Render the template tag for a given context.


[View source]