1
marcan
Multilingual theme and MLPatch
  • 2004/2/9 16:03

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


For a couple of days, I've been seraching for a way to make a them multilingual. Certain strings in theme always need to be converted if you want it in french for example. Now I have a bilingual site (english and french) and have installed the MLPath. I also needed the theme to be in the language the user shows.

I found a way to do it so I post it here. It works, but I don't know if it is the good way to do it (I'm not a coder so I can't know...)

For example, the theme 7dana-clean greats the user when he signs in by a line at the top of the theme that says:

Quote:
Hello 'username' your account


I needed that to be translated. I also needed the Search button to be translated. So, at the the top of the them.html file for that theme, I've inserted this code :

<{php}>

global 
$myts;
$myts =& MyTextSanitizer::getInstance();

$GLOBALS['xoopsTpl']->assign('ello',$myts->makeTboxData4Show("[fr]Bonjour[/fr][en]Hello[/en]"));
$GLOBALS['xoopsTpl']->assign('youraccount',$myts->makeTboxData4Show("[fr]Votre compte[/fr][en]Your account[/en]"));
$GLOBALS['xoopsTpl']->assign('search',$myts->makeTboxData4Show("[fr]Recherche[/fr][en]Search[/en]"));

<{/
php}>


Then I put the variables where they would be needed, like this for example :

<td class="pozdrav"> &nbsp;&nbsp;<{if $xoops_isuser}><{$ello}> <a href="<{$xoops_url}>/user.php"><{$xoops_uname}>a>&nbsp;&nbsp;&nbsp;<a href="<{$xoops_url}>/user.php"><{$youraccount}>


If there is a better way to do this, please post it...

Regards !

Login

Who's Online

216 user(s) are online (81 user(s) are browsing Support Forums)


Members: 0


Guests: 216


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits