Where are language-files located?

nahoj1976 wrote on Saturday, June 25, 2005:

I intend to translate openemr to swedish. Where (or which) files contain language-specific texts? (ie texts that are displayed onto the end-user)

sunsetsystems wrote on Saturday, June 25, 2005:

I’m afraid you are in new territory.  OpenEMR to date has been very US-centric, though I’ve recently been making some adaptations for a UK client.

I guess what’s needed is to break out user-facing text into PHP include files, which in turn would reside in language-specific directories.

– Rod <rod at sunsetsystems dot com>

drbowen wrote on Saturday, June 25, 2005:

I have seen language files when using CVS but I don’t remember exactly where.

nahoj1976 wrote on Saturday, June 25, 2005:

Yes, I think that should be needed.

EMR is a very international issue, but at the same time very national when talking about software. In Sweden we have I think 7 or 8 large software-systems for EMR that are only made for Sweden and only in swedish. I am sure you can imagine how much it costs in this small country with only 9 milion inhabitants…

When I have played around in openEMR I think it could be customized to swedish needs without too much effort. The main problem is the language. Then probably some tables should be changed slightly but that is a minor problem I think.

sql-ledger is also made for US I understand and there is quite a lot to do there too but that program is allready prepared for many languages. (I am tuning up the swedish in it and will customize the accounting for our tax-system)

I am not familiar to php coding but I guess I need to learn?

What structure do you think one should make for it?

openemr/locale/se for swedish language files?

Do you think one could use the same perl-script modules as in sql-ledge? (One have files in the form:
‘english_text1’ ==> ‘swedish_text1’,
‘english_text2’ ==> ‘swedish_text2’,
etc
The perlscript takes the files in the same directory and then changes each english word with the swedish (or whatever language you have) word in all files and menues.

In that way one maybe only needs to collect all the text-names into one file (or a few files) and then let the script go through all pogram-files and change the words.

just an idea…

andres_paglayan wrote on Monday, June 27, 2005:

There are at least three mayor approaches.
All of them imply replacing current English output by variables, or better yet, constants.
1. Create a language table, the first field is the variable name to use the following ones are the locales. Depending on what language, the script populates constants (the first field) from the correspondent language.
This approach is the easiest to implement, and maintain, but it trades off using more resources since you are loading the entire site translation while using just a little bit.
2. you can do the same but using a single file with constant or variables definitions.
3. For each script that throws output, create a correspondent set of  file.lang…php files for each language. Place the file.lang.php in a subdir lang/ relative to the script that executes.
This approach is a little more tedious to implement, but once is done is as easy or easier to maintain than 1 and 2, and it only loads the constants to be used.
I suggest the number 3, a single function, something like: load_lang();,  that takes care of loading the right file depending in the lang set has to be called in each script.

sunsetsystems wrote on Monday, June 27, 2005:

Gettext might be the way to go.  See this article:

http://www.onlamp.com/pub/a/php/2002/06/13/php.html

– Rod <rod at sunsetsystems dot com>

synseer wrote on Monday, June 27, 2005:

Rod,
      I would recommend against gettext. The FreeMED project tried to use it and had lots of problems. The have a home grown gettext system that worked very well. I would talk to Jeff B. about it.

     We are using IntSmarty, which is good because it is the only one that handles Unicode properly. Look here…

http://op-en.org/wiki/index.php?title=ClearHealth_Translation_Guide

for how our system works, and for links to IntSmarty.

HTH,
Fred Trotter

andres_paglayan wrote on Monday, June 27, 2005:

gettext doesn’t sound like adding simplicity and easy to use, it is yet another thing to be configured by the one who is installing.
and at the code level you must add something like
echo gettext(“A string to be translated would go here”);
for each string output, and building concatenated strings will be a pain.
With any of the other suggested approaches you just do something like
echo $menu_text;
or you can use a constant,
echo MENU_TEXT;
And concatenating and other text juggling will be much easier.

nahoj1976 wrote on Monday, June 27, 2005:

Hmm. Interesting.
This means that by simply putting the english text in brackets | …/| it will be possible for anyone with another native language to create own language-files and get the program in her own language.

I like that! It seams to be the most efficient way of making it. I guess it also could help when checking a program in order to controle that the same titles are used throughout the program. One only generates the language-file and then check if the same term is called differently or spelled differently…

by the way: I understand there are 3 different emr: freemed, openemr and clearhealth that all three have about the same functions. openemr and clearhealth even use the same billing system.

Which one is easiest to modify concerning adress-fields, patient-fields (for example ssn -> personal number that includes both dob and ssn and needs checking with 1-2 multiplication towards controlnumber) and other stuff that might need localization towards the national standards?