nahoj1976 wrote on Thursday, August 11, 2005:
Hi
I have started to test including support to other languages according to what
was said in the discussion thread about it.
I have so far added a directory structure like this:
openemr
/locale
/se
/en
I have added a variable into two files: ($lang="se")
/interface/globals.php
/library/sqlconf.php
Then I have created files with similar names as the files I change and placed
them into the directories /se and /en
For each changed file have I added a few lines in the beginning.
The file login_screen.php located in /interface/login is changed so that it
looks like this:
- - -
<?
$ignoreAuth=true;
include_once("./globals.php");
include_once("…/locale/$lang/login_screen.php");
?>
<html>
<head>
</head>
<body ONLOAD=“javascript:top.location.href=’<?echo
“$rootdir/login/login_frame.php”?>’;”>
<a href=’<?echo “$rootdir/login/login_frame.php”?>’><?echo $text1?></a>
<p>
<?echo $text2 ?>
</body>
</html>
- - -
the file /locale/en/login_screen.php looks like this:
- - -
<?php
// /locale/$lang/login_screen.php
$text1 = "Follow manually";
$text2 = "OpenEMR requires Javascript to perform user authentication."
?>
- - -
The other files I have changed and added in a similar way.
This works all right but there are a few things that I don’t like and therefor
should need to discuss with someone before doing more:
1. In openemr the files don’t have unique names. This will give problems when
using this nomenclature if one uses the file-structure with one directory for
local/$lang.
2. The alternative to use one $lang sub-directory for each directory in the
structure is possible but not very good when later on adding more languages
and when checking that everything is working and that everything is
translated.
3. Another alternative is to not use files with the same name as the ordinary
file but then one needs a place to keep tracking of what languagefile
corresponds to what file.
4. Another possibility is to use the smarty-functions for multi-language
support but then one need to add smarty into the system and I am not too keen
on that.
Please give me some feed-back since multilanguage support in openemr will
influence all code written and we therefore need to agree on the structure.
In sql-ledger one adds all text-variables into a large array and then one uses a
perl-script to include it into the files but I am not sure exactly how. That could also be an option if one understands how it is done.
/Johan