воскресенье, 12 июня 2011 г.

Finished integration of custom localization tool

Hi there,

The summer is already begun, and in both meanings of this word "it is very hot". Moreover, that the sun terribly bakes, so more and the work on a project, also so boils. The week, which is about to end, was also heavily rich within different events
First of all I'd like to tell you that I already passed the last exam in my student life. I got an excellent estimation, and I'm really happy of that fact that now I'm computer science engineer. And you know, that it's such ambiguous feeling - to come to the finish of your student life. From one hand, you are so happy that you've finally got the degree, but from other hand, you are just little sad, that the days of fun, days of careless life have been finished. But we should not be distressed, because GSOC is gaining speed, and more and get more interesting.
As for my project, this week I finished integration of already developed the custom localization tool. And it's all thanks to this hard work, which we've done with my mentor so far.
So, now I can tell you how it work in general. As you should have known, OpenMRS has two wizard. One for installation and another for database update.
First of them is running when application is starting first time after deploy. As soon as the wizard starts up the choise language page will be shown to user. Since we running wizard for first time and we do not have any db installed at this time, the localization tool should make a decision, which language to use for this page. It chooses the language as follow:

  1. it looks into http request object and gets client's system locale. If this locale is supported by OpenMRS it shows first page of initial setup wizard translated for this locale.
  2. if this locale isn't supported by application or, just not specified, localization tool makes a decision to use english translation for first page by default.
At first page user can select preferred language to use it further (within wizard) or leave everything as is. So, selected by user language will be used to show translation for pages during wizard running. User can also  specify that it's need to OpenMRS to remember his choise for further using (within application in general -e.g., for using it when db update wizard will be runned). In this case, after sucessfull finishing of installation wizard, localization tool will check if user turn on this feature, and if it's true, localization tool will store the user selected language into db:
  1.   first, as user property,
  2.   and next, as OpenMRS system default locale.
As for database upgrade wizard, there is one special thing. This wizard can only be runned by user, who has admin privileges. In fact, update wizard has extra page for user to log in. So, before user logged in, custom localization tool also makes a decision which translation to use for first page of update wizard. It makes this decision as follows:
  1. it looks into http request header and gets client's system locale. If this locale is supported by OpenMRS it shows first page of database update wizard translated for this locale.
  2. if this locale isn't supported by application or, just not specified, localization tool makes a decision to use OpenMRS system default locale (as you know, it could be specified  when initial setup wizard is running).
  3. and if system default locale is also not specified it uses english translation by default.
After user logged in into database update wizard, system already knows, who is this user (we know his username), localization tool looks into db for user locale property. And if it exists, it uses corresponding translation of update wizard pages. If not. it uses the language, which was choosen before log in. 
So, this week I was solving of some problem , which were as obstaclefor providing descripted above behaviour.
By and large, this week I was solving some problems, which were as obstacle for providing behaviour, mentioned above.  And now, we have first realy working version of custom localization tool. And yes, it should be strongly tested. But it's an issue to be solved on next  two weeks.

I guess, that this is all for this time, if you have any questions or suggestions, please, leave them within comments below.

With best regards, Taras Chorny!

Комментариев нет:

Отправить комментарий