views:

244

answers:

1

i am developing a site that needs to have American and UK versions with mostly identical content. the differences in language are minor so i'm not looking for translation software. ideals i'm aiming for something that has two text fields per post. one for the US text and one for the UK text. there needs to be a fairly large gallery for book characters and when i add an entry it would be ideal to just type in the first country's entry then copy and paste the 2nd country's into the 2nd text field and change some words (math to maths, for instance). this would save me a lot of time and make future updates much simpler.

is there anything out there that has any features similar to this or will i need to create my own from a framework such as codeigniter or MODx?

thanks for reading, and i appreciate any help with this issue.

A: 

You could use the regular document variables (pagetitle, content, etc.) for the primary language and template variables in MODx for the secondary. Set a session variable for the user's choice at runtime and then make a plugin that executes when the page is parsed to insert the appropriate fields in your document. It'll take a good understanding how MODx templates work with placeholders.

Something like this in your plugin:

if ($_SESSION['userlang'] == 'en-us'){
  $content = $modx->documentObject['content'];
} else {
  $tv = $modx->getTemplateVarOutput('ukContent');
  $content = $tv['ukContent'];
}
$modx->setPlaceholder('content', $content);
Brandon
very helpful thank you brandon!
measles