The translation is temporarily closed for contributions due to maintenance, please come back later.
The translation was automatically locked due to following alerts: Could not push the repository.

Source string Read only

type: Content of: <section><section><section><section><title>
7/100
Context English State
[% Data.CreateTime ǀ Localize("TimeLong") %]
# Result for US English locale:
06/09/2010 15:45:41
First, the data is inserted from the application module with <literal>Data</literal>. Here always an ISO UTC timestamp (2010-06-09 15:45:41) must be passed as data to <literal>[% Localize() %]</literal>. Then it will be output it according to the date/time definition of the current locale.
The data passed to <literal>[% Localize() %]</literal> must be UTC. If a time zone offset is specified for the current agent, it will be applied to the UTC timestamp before the output is generated.
There are different possible date/time output formats: <literal>TimeLong</literal> (full date/time), <literal>TimeShort</literal> (no seconds) and <literal>Date</literal> (no time).
[% Data.CreateTime ǀ Localize("TimeLong") %]
# Result for US English locale:
06/09/2010 15:45:41

[% Data.CreateTime ǀ Localize("TimeShort") %]
# Result for US English locale:
06/09/2010 15:45

[% Data.CreateTime ǀ Localize("Date") %]
# Result for US English locale:
06/09/2010
Also the output of human readable file sizes is available as an option <literal>Localize('Filesize')</literal> (just pass the raw file size in bytes).
[% Data.Filesize ǀ Localize("Filesize") %]
# Result for US English locale:
23 MB
<literal>[% ReplacePlaceholders() %]</literal>
Replaces placeholders (%s) in strings with passed parameters.
In certain cases, you might want to insert HTML code in translations, instead of placeholders. On the other hand, you also need to take care of sanitization, since translated strings should not be trusted as-is. For this, you can first translate the string, pass it through the HTML filter and finally replace placeholders with static (safe) HTML code.
[% Translate("This is %s.") | html | ReplacePlaceholders('<strong>bold text</strong>') %]
Number of parameters to <literal>ReplacePlaceholders()</literal> filter should match number of placeholders in the original string.
You can also use <literal>[% ReplacePlaceholders() %]</literal> in function format, in case you are not translating anything. In this case, first parameter is the target string, and any found placeholders in it are substituted with subsequent parameters.
[% ReplacePlaceholders("This string has both %s and %s.", '<strong>bold text</strong>, '<em>italic text</em>') %]
Template Processing Commands
Comment
Lines starting with a # at the beginning of will not be shown in the html output. This can be used both for commenting the Template code or for disabling parts of it.
# this section is temporarily disabled
# <div class="AsBlock">
# <a href="...">link</a>
# </div>
<literal>[% InsertTemplate("Copyright.tt") %]</literal>
Please note that the <literal>InsertTemplate</literal> command was added to provide better backwards compatibility to the old DTL system. It might be deprecated in a future version of OTRS and removed later. If you don't use <link linkend="block">block commands</link> in your included template, you don't need <literal>InsertTemplate</literal> and can use standard Template::Toolkit syntax like <literal>INCLUDE/PROCESS</literal> instead.
Includes another template file into the current one. The included file may also contain template commands.
# include Copyright.tt
[% InsertTemplate("Copyright") %]
Please note this is not the same as Template::Toolkit's <literal>[% INCLUDE %]</literal> command, which just processes the referenced template. <literal>[% InsertTemplate() %]</literal> actually adds the content of the referenced template into the current template, so that it can be processed together. That makes it possible for the embedded template to access the same environment/data as the main template.
<literal>[% RenderBlockStart %]</literal> / <literal>[% RenderBlockEnd %]</literal>
Please note that the blocks commands were added to provide better backwards compatibility to the old DTL system. They might be deprecated in a future version of OTRS and removed later. We advise you to develop any new code without using the blocks commands. You can use standard Template::Toolkit syntax like <literal>IF/ELSE</literal>, <literal>LOOP</literal>s and other helpful things for conditional template output.
With this command, one can specify parts of a template file as a block. This block needs to be explicitly filled with a function call from the application, to be present in the generated output. The application can call the block 0 (it will not be present in the output), 1 or more times (each with possibly a different set of data parameters passed to the template).
One common use case is the filling of a table with dynamic data:
<table class="DataTable">
<thead>
<tr>
<th>[% Translate("Name") | html %]</th>
<th>[% Translate("Type") | html %]</th>
<th>[% Translate("Comment") | html %]</th>
<th>[% Translate("Validity") | html %]</th>
<th>[% Translate("Changed") | html %]</th>
<th>[% Translate("Created") | html %]</th>
</tr>
</thead>
<tbody>
[% RenderBlockStart("NoDataFoundMsg") %]
<tr>
<td colspan="6">
[% Translate("No data found.") | html %]
</td>
</tr>
[% RenderBlockEnd("NoDataFoundMsg") %]
[% RenderBlockStart("OverviewResultRow") %]
<tr>
<td><a class="AsBlock" href="[% Env("Baselink") %]Action=[% Env("Action") %];Subaction=Change;ID=[% Data.ID | uri %]">[% Data.Name | html %]</a></td>
<td>[% Translate(Data.TypeName) | html %]</td>
<td title="[% Data.Comment | html %]">[% Data.Comment | truncate(20) | html %]</td>
<td>[% Translate(Data.Valid) | html %]</td>
<td>[% Data.ChangeTime | Localize("TimeShort") %]</td>
<td>[% Data.CreateTime | Localize("TimeShort") %]</td>
</tr>
[% RenderBlockEnd("OverviewResultRow") %]
</tbody>
</table>
The surrounding table with the header is always generated. If no data was found, the block <literal>NoDataFoundMsg</literal> is called once, resulting in a table with one data row with the message "No data found."
If data was found, for each row there is one function call made for the block <literal>OverViewResultRow</literal> (each time passing in the data for this particular row), resulting in a table with as many data rows as results were found.
Let's look at how the blocks are called from the application module:
ComponentTranslation
This translation Translated OTRS 6/Developer Manual Comment
The following string has the same context and source.
Translated OTRS 6/((OTRS)) Community Edition Comment

Loading…

User avatar None

New source string

OTRS 6 / Developer ManualEnglish

New source string 10 months ago
Browse all component changes

Glossary

English English
No related strings found in the glossary.

Source information

Source string comment
type: Content of: <section><section><section><section><title>
Flags
read-only
Source string location
en/content/how-it-works/templates.xml:346
String age
10 months ago
Source string age
10 months ago
Translation file
i18n/doc-developer.pot, string 946