Welcome Guest, Not a member yet? Register   Sign In
language versus html markup?
#1

I'm working on a site that will be delivered in at least English and Spanish (and possibly French, German et. al). I've reached a bit of a conundrum when it comes to displaying in-language prompts that are fairly extensive -- especially when I want to a) merge db data into the text and b) when I want to use HTML markup.

For example, at registration I want to send a welcome-to-our-site email that has HTML markup. In English, this email is likely to look something like this:
Code:
<p><b>Welcome to SiteX</b><.p>
<p>Dear <?php echo $username; ?>,</p>
<p>We are proud to welcome you to our awesome new website blah blah blah blah blah amazing features blah blah blah.</p>
<p>If you ever want to change your preferences please visit <a href="<?php echo $preference_url; ?>">The Preferences Control Panel</a>.</p>

This is obviously in English but I will want one in Spanish too. My instinct would be to create a separate view for the Spanish version of this file, but view loading is not language-aware like the language files are. If I were to do this in some CodeIgniter-orthodox way using language files, I might need to load each paragraph separate from a language file and merge $username and $preference_url into the resulting in-language strings and then merge this, in turn, into my view which would probably be JUST HTML markup like this:
Code:
<p><b><?php echo $welcome_message; ?></b><.p>
<p><?php echo $username_salutation; ?></p>
<p><?php echo $paragraph_1; ?></p>
<p><?php echo $paragraph_2a; ?><a href="<?php echo $preference_url; ?>"><?php echo $paragraph_2b; ?></a>.</p>
Or something like that. Notice how crazy that last line gets if we avoid HTML markup in our language strings.

Does anyone have a way of handling language localization+html markup+merged data all at the same time?
Reply


Messages In This Thread
language versus html markup? - by sneakyimp - 10-14-2016, 12:42 PM
RE: language versus html markup? - by InsiteFX - 10-14-2016, 01:18 PM
RE: language versus html markup? - by sneakyimp - 10-14-2016, 01:29 PM
RE: language versus html markup? - by Ivo Miranda - 10-14-2016, 03:05 PM
RE: language versus html markup? - by sneakyimp - 10-14-2016, 04:41 PM
RE: language versus html markup? - by Ivo Miranda - 10-14-2016, 04:57 PM
RE: language versus html markup? - by sneakyimp - 10-14-2016, 06:14 PM
RE: language versus html markup? - by Ivo Miranda - 10-15-2016, 03:50 AM
RE: language versus html markup? - by PaulD - 10-15-2016, 04:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB