Tuesday, March 27, 2007

Oracle ApEx Globalization Tips for sleeping well

Yesterday it was my G-day: alea iacta est!

I finally decided to go global with a tiny application i am developing and i embarked myself on the translation mission.

I was really eager to start investigating the built-in translation facilities of Oracle Application Express as i felt that:
  1. There was a huge gap in the knowledge of this area on my side.
  2. I had the impression that this was one of the strongest points of Apex: a robust, flexible and powerful mechanism for delivering a localized application in almost every aspect.

Funnily enough, both facts proved to be true, at my expense.

I set out and took this application in its current development status and, following the recipe in the on-line help, i created a mapped english version.
Then i started playing aroung with XLIFF files, exporting, importing, checking and unchecking options in order to understand how the process works.
I just didn't realize exactly what Oracle meant by seeding an application.
Or better said, i didn't understand early enough the implications of seeding.

I thought it was just a way of freezing the value of labels, titles and so on, but actually it was much more than that.
One must understand that, if a dedicated application ID is required to handle each translated version, that means a lot more than just translated labels.

So, after a while i left this globalization exercise and went back to develop my application.
Strange things began to happen.
I must say, begging for pity, that yesterday i was tired, my back was in pain, the night before i went to sleep very late and woke up very early, there was a flood, the grasshoppers...

Anyway, i was modifying some processes in a page and when i went out to try them, either they didn't work as expected or they did something weird. Values disappearing without explanation. Processes that didn't fire. Checkpoints ignored.

I was really upset.

The fact is i had completely overlooked my previous globalization experiments.

Finally, for some reason, i took the decision that saved my night or what remained of it.

I changed the request string of a button. I don't even know why i did that, i was almost desperate, i had rewritten code, attempting to raise errors that got never fired, i was to the point to give up!

Then i went to test this final change, sort of Armageddon, to see what the hell was happening with my program, and to my big astonishment, the button was still carrying the old request.

There was a light at the end of this tunnel.

Eventually i realized that i was testing the page with a "wrong" language setting, diverting me to the translated, globalized, yet dramatically old version of the code.

As i translated only the first page and the others were still carrying the original untranslated text, i could not spot the difference between the new and the old one, moreover i hadn't change any items or layout thing, i had just been working on processes, so it looked the same, but it wasn't doing the same!

I changed the browser's language setting to match the application's primary language and everything was starting to work normally again. EUREKA!

Moral, here are my commandments:
  1. Go to bed on time.
  2. Translate an application when it's finished, not when you are still muddling the whole thing.
  3. Make translated labels look different. Do something, translate them or just put a reminder, insert something that let's you understand at once that what you see is not the original primary application's text.
  4. Set the primary language in the browser such that it matches the primary language of the application, so you don't get diverted to a translated version unless you explicitly want to test that particular version.
In case you prefer to breach my commandments, remember to seed the application for each translated version you've mapped to your primary application's language every time you make substantial changes.
Seeding will keep all application versions in sync, recycling translated attributes, purging what's no longer there and adding new entries.

But in the end i am really amazed by how simple and quick is to create a translated version of an application, even if i was almost to the point of throwing my laptop out of the window.

Happy globalization!


Jan Huyzentruyt said...

Another quirk when deploying multilingual application is the necessity to choose the same APP_ID’s for production environment, like you used in development environment. See the comment on following blog: http://iadvise.blogspot.com/2006/12/apex-deploy-your-multilingual.html

Byte64 said...

Hi Jan,
that's an important thing to keep in mind, as well as the fact that, according to the online help, you can't pick an application ID ending with a zero digit, i guess that Apex is doing some trickery using mod(app_ID,10), who knows. I never investigated or asked the rationale behind the application ID number that Apex spawns when you create a new application, but i presume they are not simply random numbers.
At any rate, on one hand it must be said that generally speaking, Apex is very flexible with the handling of this numbers, except for this case, although i have never been a fan of design models where application numbers "mean" something, like 10 is development, 100 is test, 1000 is production or stuff like that. I prefer to have distinct boxes where applications have the same number, but i do understand it's not always possible.
For instance, all my production sites are hosted at www.shellprompt.net and in more than one occasion it happened i couldn't keep my original application number because it was already taken. Rather than keeping two distinct numbers, i got the new one from the production environment and i used it in development too, changing the existing one.
On the other hand, Apex could have used the application alias to do the mapping, giving some more flexibility in terms of numbers, but that's not what we currently have.
In the end, they (the Apex team) had to figure out a mechanism that would fit most cases, so either they didn't worry about the conflicting IDs problem or they thought there were other options available anyway.

Thanks for the comment and come back from time to time!


Jan Huyzentruyt said...

Hi Flavio,

I 'll pass by from time to time ...

By-the-way, one of the first times I meet a db-developer who likes Mozart, Bach, Bartok, Shostakovich, ...

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles