Skip to Content.
Sympa Menu

en - Re: [en@sympa] mail template string localization

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: address@concealed
  • Cc: address@concealed
  • Subject: Re: [en@sympa] mail template string localization
  • Date: Wed, 25 Oct 2023 14:33:31 +0900 (GMT+09:00)

Hi,

2023/10/25 0:34:31 "punk.car6809" (via en Mailing List) <address@concealed>:

> Hi,
>
> I tried to translate a string before passing it to another template:
>
> [%# file:bye.tt2 ~%]
> [% PROCESS include_html_head.tt2
> HTML_HEAD_TYPE='alert'
> HTML_HEAD_MESSAGE="Unsubscribed from %1"|loc(list.name[http://list.name])
> %]
>
> [%# file:include_html_head.tt2 ~%]
> [% IF HTML_HEAD_TYPE == 'alert' ~%]
> [% HTML_HEAD_MESSAGE %]
> [%~ END ~%]
>
> The %1 placeholder was correctly replaced with the list name, but the
> string wasn't translated. What do I have to do, to get the translated
> string into the variable HTML_HEAD_MESSAGE?

The filter syntax (|) is not an operator but processes the output.  In your
template loc() processes the output of PROCESS directive.  What you expect
may be done for example:

[%# file:bye.tt2 ~%]
[% msg = BLOCK %][% "Unsubscribed from %1"|loc(list.name[http://list.name])
%][% END %]

[% PROCESS include_html_head.tt2
HTML_HEAD_TYPE='alert'
HTML_HEAD_MESSAGE=msg
%]

[%# file:include_html_head.tt2 ~%]
[% IF HTML_HEAD_TYPE == 'alert' ~%]
[% HTML_HEAD_MESSAGE %]
[%~ END ~%]


Regards,
-- Soji

> Best regards,
> Gregor




Archive powered by MHonArc 2.6.19+.

Top of Page