Koha-clms/t/db_dependent/misc/translator/sample.tt

48 lines
1.3 KiB
Plaintext

[% USE raw %]
[% PROCESS 'i18n.inc' %]
[% t('hello ツ') | $raw %]
[% tx('hello {name}', { name = 'Bob' }) | $raw %]
[% tn('item', 'items', count) | $raw %]
[% tnx('{count} item', '{count} items', count, { count = count }) | $raw %]
[% tp('context', 'hello') | $raw %]
[% tpx('context', 'hello {name}', { name = 'Bob' }) | $raw %]
[% tnp('context', 'item', 'items', count) | $raw %]
[% tnpx('context', '{count} item', '{count} items', count, { count = count }) | $raw %]
[% # it also works on multiple lines
tnpx (
'context',
'{count} item',
'{count} items',
count,
{
count = count,
}
) | $raw
%]
[% # and t* calls can be nested
tx('status is {status}', {
status = active ? t('active') : t('inactive')
}) | $raw
%]
[%# but a TT comment won't get picked
t('not translatable')
%]
[% BLOCK %]
[% t('Inside block') | $raw %]
[% END %]
<span>This should be picked by xgettext.pl</span>
<img alt="alt text" />
<option [% IF value == expected %]selected[% END %] title="foo title" value="foo">Foo</option>
<!-- prettier-ignore-start -->
<span [% IF show_title %]title="this is not translatable (known bug)"[% END %]></span>
<span [% IF show_title %] title="but this is (thanks to space before attribute name)"[% END %]></span>
<!-- prettier-ignore-end -->