Internationalization / Smarty
Date: 01/29/09
(PHP Community) Keywords: php, html, web
I posted this in webdev a couple days back, but I haven't gotten any replies! Maybe you wonderful people from php can help me. I'm working on making a website multilingual and I'm running into a tricky problem.
The people who set up this website used Smarty, so I'm continuing to work with it. I've got the language detection code down. Pages are grouped into sections and the text for each section is stored in a config file that Smarty can read. Each page knows which section it belongs to so it knows what section of the language file to load (thus, it ignores the rest).
The problem I'm running into is inter-paragraph links. For example:
Lots of text with a link to another location.
Pre-this-I18N push, the template files simply had {$rootPath}somewhere.php
stored in them, with $rootPath
containing the appropriate path. However, Smarty variables can't be used inside language config files like this. In general I'm unhappy about having HTML inside these files, but it's difficult not to when, for example, you only have parts of a sentence bolded. My only choice seems to be to split this into preLinkText, linkText, and postLinkText variables, but that's exceedingly kludgy.
Have any of you worked on internationalization projects and come across this? What would you recommend to solve this issue?
Source: http://community.livejournal.com/php/656251.html