#116 webmail2: multylanguage fix for index.tpl

open
nobody
5
2007-01-27
2007-01-27
Thomas Knorr
No

Affected file:
\mgw\modules\webmail2\templates\default\html\index.tpl

The template was using the new smarty plugin {tr}{/tr} for translating string constants from the language array.
But this plugin translates ONLY ONCE a template is created for the template cache. The result is a fixed string in ****.tpl.php which will never change until the template must be created new for some reasons.
Every user who now needs to display these pages, will see it in it's initial language. When it was translated. Maybe in spain, but our language should be english.

This would be the result for the account list headline, the fixed string "Account List"

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#D1D1D1"><td>
&nbsp;<font color="#4E4E4E"><b> Account List</b></font>
</td></tr></table>

Bugfix

To solve this problem, the only solution could be to replace all tags with {tr}{/tr} by things like {$hashmap.webmail2_settings_list_of_accounts}

This will end in a new template entry as listed below. As you can see the strings are now fetched from an array called _tpl_vars at postion hashmap.'webmail2_settings_list_of_accounts. We'll find the string to enter here.
From now it does not matter with witch language the template was translated first.

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#D1D1D1"><td>
&nbsp;<font color="#4E4E4E"><b>&nbsp;<?php echo ((is_array($_tmp=$this->_tpl_vars['hashmap']['webmail2_settings_list_of_accounts'])) ? $this->_run_mod_handler('strip_tags', true, $_tmp) : smarty_modifier_strip_tags($_tmp)); ?>
</b></font>
</td></tr></table>

Discussion

  • Thomas Knorr
    Thomas Knorr
    2007-01-27

    multylanguage fix for index.tpl

     
    Attachments