Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Developing website in English and Arabic

 
Ranch Hand
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this to support English and Arabic data, or data in one language and display logic in both?
 
Farakh khan
Ranch Hand
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, what could be a best approach. I need help to know and follow.

thanks again for your replies
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic