aspose file tools*
The moose likes JDBC and the fly likes Developing website in English and Arabic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Developing website in English and Arabic" Watch "Developing website in English and Arabic" New topic
Author

Developing website in English and Arabic

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 742
Hello,

I have a task to develop a website in English and Arabic. Java Servlet and Oracle will be used.

I did all projects in English and don't have idea now to deal with Arabic version.
What changes will be required in Oracle or Java Servlet any idea. Please help me

Best regards
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Is this to support English and Arabic data, or data in one language and display logic in both?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 742
Paul Sturrock wrote:Is this to support English and Arabic data, or data in one language and display logic in both?


Its to support English and Arabic data

Thanks for reply and best regards
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

So you need a multi-lingual database? That is a much bigger project than the usual translation of static labels and checking everything renders right to left.

You need to consider your data model carefully, but a fairly standards way of modelling this is to have a translation entity for every translatable entity in your model. For example, you might have an "address" entity that has an associated address_tr entity which contains any translatable attributes keyed on the address pk and the locale. This would not be all the attributes because of course proper nouns don't need translated. Because you effectively double the number of entities by doing this, and hence dramatically increase the number of joins, a way to mitigate against the performance overhead is to supply views for reading data.

If you know 100% you will never have to support any other languages than the two you have entered (including no regional differences) you can simplify this by just redundantly adding attributes to existing entities for translated data.

There are a bunch of programming differences to consider for Java i18n. Have a read of this to get you going.
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 742
What if I add a column in the database by setting value 1 for English and 2 for Arabic? I'll try to make changes in Oracle character set to support both languages.

Is this good approach?

Best regards
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Not sure I understand your design. Are you suggesting redundant records, e.g. one for English and one for Arabic, and maybe a composite key? That would work too, though you have the issue that these records would need kept in sync, which you could do with a trigger. You would be replicating everything, including the stuff that you wouldn't translate this way (dates, proper nouns, unformatted numbers etc. )

Oracle will be fine assuming you set the database to use Unicode.
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 742
Thanks for your reply

There will be no redundant records at all e.g. I'll create a table e.g. with the fields name, id and lang. Now if name is inserted in arabic from arabic version then I'll put values like: arabicName, id and lang=2 and if inserted from english part then I'll insert lang as 1. I mean just lang column will be changed

is that idea okay or need some changes?

Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

That sort of sounds like the Arabic and English data is exclusive, in which case an easier solution would be to use two databases.

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 742
That will be only one database table with same columns but one column of the table identify either the data belongs to Arabic or English version.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

So there will be redundant data then? A record may exist in Arabic and English? If not, I'd suggest you use two databases - I suspect this will be much simpler.

Suppose you have an entity with ten attributes, nine of which are numbers and one is a translatable character data. It weakens your data model to redundantly keep two copies of the nine numeric fields because these don't need translated. Your design means this is necessary, having the translated data only in a separate related entity means you only need one copy of your untranslated data.
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 742
Yes this will be same data but translated in two different languages and on column of the table will identify that this is English set of data and this is Arabic set of data. Just one column will be identical other will contain same information e.g.
id, name, rollNo, lang. The id and rollNo will be same but name will be stored either in arabic or in english and lang field will identify. The java i18n will change the display by getting info from lang column of the table

what you think about this approach?

Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

It leaves the scope that rollNo will get out of sync, especially if you have to support other languages in the future, or other client you don't write get to update the data. A trigger to keep these in sync is maybe an option.
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 742
Well, what could be a best approach. I need help to know and follow.

thanks again for your replies
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

"Horses for courses" as they say - by that I mean the "best" solution is not the best in all situations. As I said earlier, the common solution you see people implement is a separate translation table per entity and views for read only queries. But this could be over engineering the solution for your needs. Its up to you really.
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 742
Thanks Paul

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Developing website in English and Arabic