Helping ordinary people create extraordinary websites!

Internationalisation and my PHP Development Infrastructure

By Tony Marston
2005-07-17

My Implementation - Load Screen Structure file

This uses the getLanguageSubDir()function to locate the relevant language subdirectory for the ./screens path before loading in the specified screen structure file.

function setScreenStructure ($xml_doc, $root, $screen, $xsl_file)

// extract screen structure from named file and insert details into XML document.
{
// get subdirectory which matches user's language code
$subdir = getLanguageSubDir ('./screens');

$screen = "$subdir/$screen"; // look in subirectory for this screen name
if (!file_exists($screen)) {
// 'File $screen cannot be found'
trigger_error(getLanguageText('sys0056', $screen), E_USER_ERROR);
} // if

require $screen; // import contents of disk file
.....

Note that it does not matter if the only subdirectory that exists for screen structure files is in the default language as all the field labels will be translated into the chosen language at a later stage.





Tutorial pages:
 1 Votes

You might also want to check these out:


Leave a Comment on "Internationalisation and my PHP Development Infrastructure"
You must be logged in to post a comment.

Link to This Tutorial Page!


GET OUR NEWSLETTERS