Foreign Language Support

blankev wrote on Saturday, March 28, 2009:

PHP software wizzards,

Is there somebody who can create somethings as follows, (I took it from globals.php,) to make it usable  for each seperate page where wanted? Make for that specific pagecomplex a translation option? It would give us the opportunity to change the language settings for that specific page and reset to default ofter leaving that part of PHP and can use it for complete translated specific parts of OpenEMR. When leaving that page it could be set back to the used default as stated in global.php  What I basicaly ask: " is this the way to go for Language toggling? "

// Language Control Section (will add toggling)
// English:1, Swedish:2, Spanish:3, German:4, Dutch:5, Hebrew:6
define (‘LANGUAGE’,1);

Would it owrk if we include:

<?php
define(‘LANGAUGE’,5);

comments;
commands etc;
dsfklsdg;
srgwreg;
srefwgb45fgsv;

define ('LANGUAGE,1);
?>

bradymiller wrote on Saturday, March 28, 2009:

hey,
I had to regroup on my perls script; not nearly as straightforward as I initially thought to collect all the constants form the source code.  I ended up with 3658 constants (perl scripts and output discussed in more detail below).

I have posted a collaborative spreadsheet at https://personal.zoho.com to simplify entering of translation codes.  The rules of the spreadsheet are that you can’t modify constants or constant ID numbers.  Adding constants to bottom of list and adding languages is ok, though.  Let me know if you want to edit the spreadsheet so i can give you access.  Once we decide on a mechanism (ie. sql dump to create 3 language tables vs other mechanisms), it should be straightforward to convert this spreadsheet to whatever is needed.

Here are the details of collecting constants:
perl script:
http://www.sparmy.com/scripts/collectConstants.pl

list of constants:
http://www.sparmy.com/scripts/constants.txt

constants in tab-delimited spreadsheet (this was posted to zoho.com):
http://www.sparmy.com/scripts/constants2.txt

-brady

blankev wrote on Monday, March 30, 2009:

Brady,

are you sure and did you chack teh written software and xl codings? I see some quite different english_constants than used in older versions.

There was no way for me to match the older version of constants with your coding schedule. But with trial and error and a lot of resortings I managed to get halfway.

Now I got translations done for about 1000 constants but did not yet check for compatibility of the used translations.

I also missed some sentences in version 3.0.0, or has the coding of constants changed in time and do we use different parts of sentences now compared to version 2.8.3?

For future explorations, could your script be re-written so as to find a certain sentence to see why it was not yet transformed in a constant? Or without total mismatch could any part of the php files automatically be transformed with xl codings?

For example: Could you find the $ Sign that is used for payments etc? For internationalization it would be great to change all into local currency signs.

Except for the Dutch Psychiatry part named OpenEPR we should try to keep the original texts used in plain English en make translations with Language changes. If I use Language "5" I get part of OpenEMR with the OpenEMR version, due to DutchPC somewhere in the codings. So in the manual it has to be a warning, or we have to change the involved coding of php files.

I see a lot of nice things in ZOHO at:

https://personal.zoho.com/

But could not find the mentioned spreadsheet, what went wrong?

Pimm

bradymiller wrote on Monday, March 30, 2009:

Pimm,
  You’re a member of the openemr group at zoho, so you should be able to view the file in the ‘documents’ or ‘sheet’ view. Document is titled openemr_language_table
-brady

bradymiller wrote on Tuesday, March 31, 2009:

Pimm,

For sanity checking (I’m assuming your using linux) of the constants try this command:
grep -r “your constant of interest” /directory/to/openemr

This will type out where in files the constant of interest is found.

-brady

bradymiller wrote on Thursday, April 02, 2009:

hey,

zoho.com was awful, so have moves the language translations spreadsheet to google.

If, you want access to edit/add a language, let me know.

-brady

aperezcrespo wrote on Thursday, April 02, 2009:

Hi

Where in google docs?  Link please…

Thanks
Alfonso

bradymiller wrote on Thursday, April 02, 2009:

hey,
just send me your email address to brady@sparmy.com so i can invite you.
-brady

blankev wrote on Friday, April 03, 2009:

Brady and all involved in translation,

If and when you make changes, please ask (Brady please give permission to)  for your own translation collum in the spreadsheet, so after a while we can decide what might be the best translation in given situation.

Do not change anything that does not belong to your own entity, so confusion will be kept to a minimum.

Downloading your translation column (or mine in case of Dutch translation) and given the right "id", you can upload it in your personal version OpenEMR. (A manual with instructions is in the making, but need more time)

Whenever a new version of OpenEMR is used you have to "again" upload your lang_definitions and lang_constants.

Remember to get the translations to work you need to change global.php of your OpenEMR version.

Change: definition (‘language’, 1) into (‘language’, 3) of whatever your lang_defid (???) will have as a number in the future (this ins the one number assigned to you lang_language).

If needed change read write permissions for globl.php and change them to original settings afterwards.

REAMRK: Not all English parts a coded as should, so you will find some English in every translated version of OpenEMR.

Pimm

bradymiller wrote on Saturday, April 04, 2009:

hey,

Just so everybody’s aware of my current plan, here it is. Goal is to get this done over next several months:

Finished:
1. Created script to collect all constants from our source code. There were about 3600 constants. This script can also be used in future to collect new constants.
2. This list of constants was then converted into a google docs spreadsheet to allow a collaborative translation process.

Pending:
1. Create a script to build the foreign language sql tables from the language spreadsheet
2. Have user choose language in login menu (then no need for the globals.php language settings)
3. Testing to fix places where translations not appropriately coded into source.
4. Think about other mechanisms such as single language inserting etc. especially if performance becomes an issue.

This plan is, of course, up for debate

-brady

bubbsnurr wrote on Saturday, April 04, 2009:

Hi all!

So if i have the constant "has been created." wich is "har skapats" translated in to swedish. Exactly what do I need to change and in wich files to get the constnt translated in openEMR?

bradymiller wrote on Saturday, April 04, 2009:

hey,

To see it work:
choose swedish in the openemr/interface/globals.php file
login in to openemr
go to admin->languages.
Then click add constant and type in your constant.
Then click on swedish and you will be able to now type a translation.
OpenEMR will now "translate" that constant

As you can see we have the machinery in place, we are just missing the actual database (it was recently removed because of several problems).

We now host collaborative spreadsheet on Google Docs with the 3600 constants in OpenEMR.  If your willing, we’d be glad to have you start entering translations for Swedish.  We will then use this spreadsheet to create the language tables and continue to expand OpenEMR’s languages in the future.  Email me at brady@sparmy.com if you are interested in helping out with translations.

-Brady

blankev wrote on Saturday, April 04, 2009:

Brady,

I did not yet try your suggestion with working translations in your suggested demo version. In the past,  in the demo versions I encountered problems if a couple of translations were made. Also when making a mistake, and later you wanted to correct the typos it seemed not to work. I only could make changes within MySQL database, I usually use phpMyAdmin and that is rather straightforward and little chance to make mistakes that can not be handled without taking risks for OpenEMR, and as long as you have ADMIN rights you should be familiar with global.php and most probably can do the job with good intructions. phpMyAdmin is available with most demo versions and also in XAMPP versions

I am working on the manual. For now the first hurdle is importing the CSV file in lang.definitions table. Some of the definitions are not compatible with CSV, due to the use of "… ;… " or the use of quotation marksor the &amp; in the text. I know this can be solved by deleting that sentence or by change to other kind of ?quotation marks?, but the the original sentence will not bet translated.

Till this problem is solved, can we offer to use usable spreadsheet without the sentences that give problems importing and ready to import with CSV file format? If feasible, I send you my to import as CSV ready for phpMyAdmin and MySQL and that will be imported in any personal OpenEMR version, so to say, ready for import. Than I can continue with the Language translation manual. This LTM is some extra about importing all field in the right table witk the right coding and some updating of you excelent LTManual version of 2008.

Later we can change the manual if your found enough time to complte import through scripting etc.

Pimm

blankev wrote on Saturday, April 04, 2009:

Brady,

some remarks on your note two messages earlier.

I tried your suggestion on versions OpenEMR 3.0.0 but could not get it to work! It used to work flawless in the past so some programmers changed the code.

Also if you add a constant you need to have the xl( ) coded english text at hand to make the new definition and constant translation, otherwise it won’t work.

Pimm

bradymiller wrote on Sunday, April 05, 2009:

hey,

I’ve created a perl script that will convert our google docs spreadsheet into a mysql dumpfile for the foreign language tables in OpenEMR. In case your interested, here is the perl script:
http://openemr.cvs.sourceforge.net/viewvc/openemr/openemr/contrib/util/language_translations/buildLanguageDatabase.pl?revision=1.1

Here is the myqsl dumpfile that resulted from the script:
http://openemr.cvs.sourceforge.net/viewvc/openemr/openemr/contrib/util/language_translations/currentLanguage.sql?revision=1.1

It currently only has translations for lots of Dutch and a little Norwegian.

If you want to try it out here are instruction of how to get this installed into your OpenEMR. Please note this stuff is still very experimental, will delete your current language tables and could cause mysql devastation (ie, only use in a testing environment):
Download the above currentLanguage.sql dumpfile to your computer.
Then in OpenEMR go to 
admin -> Database -> Databases -> openemr -> SQL and click ‘Browse’
button at the ‘Or location of the textfile:’ field.  Select the currentLanguage.sql
file you downloaded to your computer, then click ‘Go’ button.

If you want to see the translations, again we only have Dutch and a littler Norwegian at this time.  Edit the openemr/interface/globals.php file at the translations entry. Put 5 if you
want to see Dutch and 8 if you want to see Norwegian. After changing setting remember to logout then login back into OpenEMR.

good luck and keep entering those translations into the google Docs spreadsheet

-brady

bubbsnurr wrote on Sunday, April 05, 2009:

I want to help with the swedish translation. Brady, did you get my mail?

/Tompa

bradymiller wrote on Friday, April 10, 2009:

hey,

Wow, we’ve gone from 173 definitions to 2513 in one week.

Here is the updated mysql dumpfile:
http://openemr.cvs.sourceforge.net/viewvc/openemr/openemr/contrib/util/language_translations/currentLanguage.sql?revision=1.2

It currently has translations for lots of Dutch, along with moderate amounts of Swedish, Spanish, and Norwegian.

If you want to try it out here are instruction of how to get this installed into your OpenEMR. Please note this stuff is still very experimental, will delete your current language tables and could cause mysql devastation (ie, only use in a testing environment):
Download the above currentLanguage.sql dumpfile to your computer. 
Then in OpenEMR go to 
admin -> Database -> Databases -> openemr -> SQL and click ‘Browse’
button at the ‘Or location of the textfile:’ field. Select the currentLanguage.sql
file you downloaded to your computer, then click ‘Go’ button.

If you want to see the translations. Edit the openemr/interface/globals.php file at the translations entry. Put 2 if you want swedish, 3 if you want spanish, 5 if you want Dutch, and 8 if you want to see Norwegian. After changing setting remember to logout then login back into OpenEMR.

The thing I’m trying to ensure looks correct are the special characters (ie the ‘a’ character with a funny circle on top and so on). I can see them, but sometimes have to play around with encoding settings in my browser.  Let me know if any problems.

good luck and keep entering those translations into the google Docs spreadsheet

-brady

bradymiller wrote on Friday, April 17, 2009:

hey,

We’ve gone from 173 definitions to 3150 in two weeks, and we’ve ambitiously added chinese.  In order to get chinese to begin working I’ve changed encoding of characters to UTF-8.  This means the special characters should now work in Firefox by default, however in other browsers you may have to tweak the encoding settings to UTF-8.

Here is the updated mysql dumpfile:
http://openemr.cvs.sourceforge.net/viewvc/openemr/openemr/contrib/util/language_translations/currentLanguage.sql?revision=1.3

It currently has following translations:
large amount: Dutch
moderate amount: Swedish, Spanish, and Norwegian
minimal amount: Chinese  (Jiam, I used a couple definitions out of context just to prove concept that we can see chinese characters in the left navbar after you login)

The best no-risk way to test your translations is on the online cvs demo, which is using the above new translation table, and allows you to select a language before logging in:
http://oemr.org/modules/wiwimod/index.php?page=DemoCVS

You can also install the mysql dumpfile into your local openemr, but note this stuff is still considered experimental, and will delete your current language tables (back your stuff up before using this). Steps to do this are below: 
1.   Download the above currentLanguage.sql dumpfile to your computer. 
Then in OpenEMR go to 
admin -> Database -> Databases -> openemr -> SQL and click ‘Browse’ 
button at the ‘Or location of the textfile:’ field. Select the currentLanguage.sql 
file you downloaded to your computer, then click ‘Go’ button. 
2.   If you want to see the translations. Edit the openemr/interface/globals.php file at the translations entry. Put 2 if you want swedish, 3 if you want spanish, 5 if you want Dutch, 8 if you want to see Norwegian, and 9 if you want Chinese. After changing setting remember to logout then login back into OpenEMR.

Other interesting translation threads:
Regarding addition of the language menu to the login menu in development version:
https://sourceforge.net/forum/forum.php?thread_id=3205507&forum_id=202506

Regarding getting openemr fully compatible with UTF-8 encoding:
https://sourceforge.net/forum/forum.php?thread_id=3208277&forum_id=202506

good luck and keep entering those translations into the google Docs spreadsheet 

-brady

drbowen wrote on Thursday, April 23, 2009:

I am creating a new multi-language guide on the wiki and need the help of the translation team.  I need the following text translated into your native language:

[code]

If you want to help translate, you will need editing privileges.  Please contact Brady Miller ( brady at sparmy dot com )so he can invite you to the Google doc spreadsheet.  If your language is not already present then just add it to right column.

Please ensure you follow the rules below.

THE LANGUAGE SPREADSHEET RULES:

<ol>
<li>1. Do NOT edit the english constants or id numbers.</li>
<li>2. Do not modify already created translations until discussing with the other translators (unless an obvious typo etc.)</li>
<li>3. Ask me if you want to add a new english constant(s).</li>
<li>4. It is ok to add new languages/dialects in empty columns on right.</li>
<li>5. There is no need to enter translations if they are identical to the English constant.</li>
</ol>

If there are additional translators you will need to enter your name, email, language into the translators table (translator roster), and have Brady "invite" you to this group so that you can easily contact other translators if needed (especially if they are working on the same language).
[/code]

If you have access to the wiki you can do your translation there:

http://www.oemr.org/modules/wiwimod/index.php?page=TranslationGuide&back=WiwiHome

Sam Bowen, MD

andres_paglayan wrote on Thursday, April 23, 2009:

there’s probably a good shortcut,
running a javascript google translation API in the browser,

http://code.google.com/apis/ajaxlanguage/documentation/#Translation