[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Multilingual site

Posted on 2012-04-06
5
Medium Priority
?
256 Views
Last Modified: 2012-05-18
I want to build a php multilingual site. Let's say I want 3 languages for the beggining and then a smart way to add new languages when it needed.

Database VS Language files.

As I know there is two options.

1) I can use database tables with languages, translations, etc and every time based on user preferred language to retrieve data from the db which means lots of database requests.

2) I can use extrernal language php files with define (like some e-commerce frameworks who has different languages files into a language folder such us fr.php eng.php etc)

I want opinions about what is better using the following arguments.

1) Best performance
2) More flexible
3) More efficient
4) Intelligent way

Thanks in advance
0
Comment
Question by:Alex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 9

Expert Comment

by:wasiftoor
ID: 37816361
In my opinion, considering all of the options that you have mentioned, adding Google Translate to you pages seems to be the best option.

You can add the translate option to you page using the guidelines show on http://translate.google.com/translate_tools

Make sure that all your labels are text based and are not images so that the translation engine can easily take care of that.

Good Luck!
0
 
LVL 8

Assisted Solution

by:ee_reach
ee_reach earned 600 total points
ID: 37816503
I've tried it both ways now.  Here's what I've discovered.

If the structure of each page per language is exacty the same, and if there isn't a lot of text on each page, then I would use a database.

If the structure of each page may vary depending on the language and/or if there is a ton of text on each page, then I would use files.

Why, you ask, does it matter how much text there is?
Because each language is structurally different.  Some langs are subject->object->verb, others some other order (e.g. verb subject object,  or ver object subject.) Or perhaps the language is right-to-left instead of left to right, etc.  This means that you have to have a bunch of short phrases stored in your database, with three different versions, one for each language.

So if you are storing all these little strings in your database, you have all these little pieces of text that you have to put into different fields in your database and then you must piece them together in the right order at run time, depending on the language.  

This works fine if it is mostly navigational text, titles, photo labels, or the like.  But if it is long pages of instructions (such as a manual), writing the whole page in whatever language and then formatting it nicely in a single file saves a lot of work and will probably yield a more satisfactory result for the user.

For the same reason, it matters if each page is structurally the same for each language.  This is for a similar reason.  If you are getting the content from a database, you need to know in advance exactly where the content of each field goes for each language.  If the structure of the page varies depending on the language (e.g, in certain languages, you decide to put the navigation panel on the left but in another language it's on the right), or if the content of the page will vary depending  on the language (e.g, maybe certain content isn't supposed to be displayed in some languages), then you will be doing a bunch of tests at run time to see whether each field is needed in each spot for each language.  This is not only db intensive, but it is also error prone from a coding perspective.  In which case, you are better off with separate files.

Of course, if you have a ton of text, like manual pages, you could still store the translation of entire text of each page in a separate entry in the database.  That is somewhat of a hybrid approach.  Which isn't really what you were looking for, but it is to say that just because you have a ton of text that doesn't mean you can't use a database.  The key here is that the entire body of a single page is stored together.  At that point, whether that is a file or a database is really irrelevant, except that if you are doing the same thing for everything on the page, that will make your life much better.

In my experience, these very practical matters about language structure can eventually make you very happy or very unhappy about your choice of db or files.  But this is very site specific, so if I weren't sure, I would try creating a prototype using the approach I think would work.  (Be sure to think about different types of pages you would have - e.g., some may have a bunch of photos as icons with labels on them, but when you click on them, they may be all text at that point.)  Then I would go through the translation process with the translators (or at least someone else who knows the other languages very well) and see how that goes.  

It will help a lot if you know all three languages pretty well.  But if you don't, you will be dependent on your translators to tell you how the words in each sentence in each language are pieced together.  So it is worth going through the translation process of the prototype so you can get a good feel for what will work best with each option.

Hope this helps

ee_reach
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 1400 total points
ID: 37818112
0
 
LVL 9

Author Comment

by:Alex
ID: 37827034
Thank you all for your responses. Give me some days in order to check them and I'll come back with a feedback.
Please have in mind that it's a critical decision for me so I have to examine every case therefore I'll leave the Q for a few days open.
0
 
LVL 9

Author Comment

by:Alex
ID: 37984272
Thank you all for your posts again. For some personal reasons I coulnd't even test any of your proposals and I'll close this Q by splitting points to  Ray_Paseur for his awesome article and ee_reach for her effort to explain some things on her side.

PS : @wasiftoor Thank you for your post but your solution it's too far from what I want :-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question