Localization instructions

Most commonly desired features to be implemented in PacsOne
rvencu
Posts:53
Joined:Thu Aug 16, 2012 9:46 am
Localization instructions

Post by rvencu » Thu Nov 08, 2012 7:10 am

I see that in php files there is the pacsone_gettext() function to help localization process.

Please point me to instructions about where to create the localization files. Do you have a POT file to start with?

pacsone
Site Admin
Posts:3149
Joined:Tue Sep 30, 2003 2:47 am

Post by pacsone » Thu Nov 08, 2012 4:39 pm

You can extract all the message texts from the PHP scripts using the free/open-source program poEdit, by searching/extracting using the keyword pacsone_gettext into the POT/message catalog, which can then be translated and compiled into your localized languages for deployment.

rvencu
Posts:53
Joined:Thu Aug 16, 2012 9:46 am

Post by rvencu » Sun Nov 11, 2012 8:29 am

Thanks. After compiling the .mo file, where to place it, what the naming convention is and where to declare the site language?

Or simply put, how to load the translation?

pacsone
Site Admin
Posts:3149
Joined:Tue Sep 30, 2003 2:47 am

Post by pacsone » Tue Nov 13, 2012 10:37 pm

After compiling the binary/translated message catalog (".mo"), you need to copy/deploy it under the following sub-folder where PacsOne Server is installed:

Code: Select all

php/locale/${locale}/LC_MESSAGES/${locale}.mo
where ${locale} is the name of the locale you are currently using, e.g., "pt_br" for Portuguese in Brazil, and if you are deploying for that locale, you'd need to copy/deploy the compiled pt_br.mo under the following sub-folder where PacsOne is installed:

Code: Select all

php/locale/pt_br/LC_MESSAGES/pt_br.mo
Then you need to modify the $LOCALE_TBL variable in the "php/locale.php" script under the directory where PacsOne is installed, and add the above locale setting to the array of supported locales:

Code: Select all

$LOCALE_TBL = array(
    "zh-cn"         => array("zh_CN", stristr(getenv("OS"), "Window")? "UTF-8" : "gb2312"),
    "zh-tw"         => array("zh_TW", "big5"),
    "es-ar"         => array("es_AR", "UTF-8"),
    "fr-fr"         => array("fr_FR", "UTF-8"),
    "pl-pl"         => array("pl_PL", "UTF-8"),
    "it-it"         => array("it_IT", "UTF-8"),
    "pt-br"         => array("pt_BR", "UTF-8"),
    "ru-ru"         => array("ru_RU", "UTF-8"),
);

rvencu
Posts:53
Joined:Thu Aug 16, 2012 9:46 am

Post by rvencu » Wed Nov 14, 2012 5:47 am

Very good, thank you.

Is there a way to assign a language for a specific user? Or everybody will see a list of available languages?

rvencu
Posts:53
Joined:Thu Aug 16, 2012 9:46 am

Post by rvencu » Wed Nov 14, 2012 4:01 pm

I followed the instructions and played a bit with locale.php file

Finally I declared manually that

Code: Select all

$locale = "ro-ro";

What I found out differently is that the name of file would need to be ro_RO.mo with proper uppercase.

After this the translation was loaded. I still have a bug: my diacritics appear crippled, the charset is loaded as UTF-8 but for some reason I cannot make the diacritics to display properly. Do you have any idea about that?

The Poedit project is in order, I made many localization projects using it, it is also UTF-8, etc.

pacsone
Site Admin
Posts:3149
Joined:Tue Sep 30, 2003 2:47 am

Post by pacsone » Wed Nov 14, 2012 4:35 pm

1. Did you check your web browser's character encoding setting and see if it's set to Unicode as well?

2. Did you try the same page with a different web browser and see if you get the same diacritics problem or not?

rvencu
Posts:53
Joined:Thu Aug 16, 2012 9:46 am

Post by rvencu » Wed Nov 14, 2012 4:46 pm

yes, all is the same in all browsers, I added UTF-8 even in php.ini as default. No change

Until I tried different encoding and changed the line like this:

Code: Select all

"ro-ro"         => array("ro_RO", "ISO-8859-16"),
With this one suddenly all my diacritics are displayed as they should... Very weird.

Anyway, do we have user-based localization settings or I should leave the extra line I used inside the locale.php file?

pacsone
Site Admin
Posts:3149
Joined:Tue Sep 30, 2003 2:47 am

Post by pacsone » Wed Nov 14, 2012 5:48 pm

The locale setting is per-website based, so you can't have one locale setting for one browser/user and another locale for another user.

rvencu
Posts:53
Joined:Thu Aug 16, 2012 9:46 am

Post by rvencu » Sun Dec 02, 2012 10:56 pm

Thanks. Please also suggest me the best approach to localize the emails the server sends.

pacsone
Site Admin
Posts:3149
Joined:Tue Sep 30, 2003 2:47 am

Post by pacsone » Tue Dec 04, 2012 10:19 pm

Are you referring to the statistics report emails? If so, then the message texts for the statistics emails are contained in the php/statistics.php script.

rvencu
Posts:53
Joined:Thu Aug 16, 2012 9:46 am

Post by rvencu » Wed Dec 05, 2012 4:59 am

thanks, I am refering mostly to notifications that goes to users (i.e. like when a new study arrived)

pacsone
Site Admin
Posts:3149
Joined:Tue Sep 30, 2003 2:47 am

Post by pacsone » Wed Dec 05, 2012 4:43 pm

Do you mean the Subject field of the statistics report emails?

rvencu
Posts:53
Joined:Thu Aug 16, 2012 9:46 am

Post by rvencu » Wed Dec 05, 2012 6:12 pm

In the statistics report emails I seen some of things are not localized. I will do it in the page you mentioned.

However I want to check every kind of emails the system sends, and localize them all, especially if they go to the doctors. Hence I am asking where to locate those ones.

It is about everything, subject, body, signature, etc

Thanks

pacsone
Site Admin
Posts:3149
Joined:Tue Sep 30, 2003 2:47 am

Post by pacsone » Thu Dec 06, 2012 12:04 am

The Subject field can be localized via the following PHP source scripts:

php/dailyreport.php
php/monthlyreport.php
php/weeklyreport.php

We'll add the localization for these scripts in the next release of PacsOne Server.

Post Reply