Multilingual applications
The other day, at work, there was a discussion about possible ways to create an application that could easily be ported into different languages. At the end, we got stuck on two possibilities. One was to simply make a new copy of the database and translate all design elements. The second one was to have a string repository (either in the same database or in central place) and then load strings from there.
Which to pick?
With first possibility, we can say goodbye to design templates and every database in different language has to be maintained separately which can have major influence on maintenance costs. Also re-translating every prompt could end up in code corruption. On the other hand, as all strings are in design elements, there are no ill effects on application performance. Second possibility allows each and every database design to be updated from the same template, thus minimizing code corruption risks and maintenance costs. However, loading all those strings into design elements can present a significant performance issue.
Test preparations
I decided to create a test database that would shed some light upon performance issues with using string repository. I managed to randomly create 300 string resources via agent. Then, I created 3 forms containing 200 computed values each. Computed values would first obtain a random number from 1 to 300 and then load specific string. Why 3 forms? Two of them were using a bad programming habit I came across, using NoCache and ReCache parameters in all @DbLookups. The last one was the one with first @DbLookup re-caching data and all others reading from that cache.
I created another 3 forms, similar to these, but with a little twist. Those forms would read strings from different database.
Now all that I lacked was a sufficient timing system. That was a piece of cake. I created a timer class, which basically reads tick count using GetThreadInfo function on QueryOpen and PostOpen events on the form. Then it recalculates tick count difference into seconds and prints a result in the status bar of Notes client.
The test
I decided to perform a test on a working development server. Each form was used to create 10 documents twice. Once on a regular database and once on full text indexed one. Results of testing (in seconds; comma delimits decimal places) are displayed in images below.
The conclusion
Results were a surprise. With forms opening with delays from 0.9 seconds up, there is no way of using string resources to load each and every string used in an application. Even if string repository is in the very same database and the database is full text indexed.
Obviously separate databases are no big solution as well, due to above mentioned reasons. Perhaps one could get away with having separate forms/sub-forms and only use string repository for prompts and in scripts and thus avoid possibility to corrupt application code.
Leave a Reply