I am implementing UTF-8 character support in my project. we use template tool kit. In one of the templates I have this hard coded drop down code that is not allowing me to translate the text. here is the code snippet.
<select id="sub_select" name="sub_select">
[% sub_options = [
- { value => 'last', choice =>'translate.$lang.L_Submission' },
- { value => 'all', choice => 'translate.$lang.A_Submissions' },
];
%]
[% INCLUDE dropdown.tmpl
options = sub_options
selected = sub_select
%]
</select>
Where dropdown.tmpl is a centralized file that is used to create the Drop downs all over the application.
I have the liberty to create a new dropdown_UTF8.tmpl, which will support the new type of choices or I can accommodate the new logic into this dropdown.tmpl.
Currently when I am trying this with existing dropdown.tmpl, I am getting translate.$lang.A_Submissions and translate.$lang.L_Submission as the choices, where as I am expecting the translated data to be displayed. Can any one help me with this.
dropdown.tmpl:
[% valuekey = valuekey || 'value';
choicekey = choicekey || 'choice';
FOREACH opt = options;
- value = opt.$valuekey.defined ? valuekey_prefix _ opt.$valuekey : valuekey_prefix _ opt
- choice = opt.$choicekey or value
%]
[% value = value %]
<option value="[% value %]"[% selected="selected" IF value == selected %]>[% choice %]</option>
[% END -%]