|
Posted by J.O. Aho on 04/16/06 00:42
Neeper wrote:
> My website has about 20 pages that are all currentyl in English. I
> want to be able to add support for Japanese. I've researched around
> and not sure what is the best way in terms of using a database table,
> flat file or arrays for storing the different language translations.
> I've experimented with mysql to store the language translations but
> had problems retrieving the utf8 stored data.
You sure you have had the mysql to store the data in utf-8? If not, then
retrieving the data won't work well.
> And then I saw an
> article saying using arrays in seperate files is better in terms of
> performance... What is the best way to do this?
Looking on most of the already written php-portals, they all seem to use files
to handle translations. Not in arrays, but in variables and storing one
language per file and depending on which language to use, you load that file.
This system, with variables, makes it a lot easier to see the translations for
a language and adding support for a new language is a lot easier than with
arrays, as you don't have the risk of mixing the order languages are supposed
to come in the array.
Using a sql server will create unnecessary overheads, and would slow things a
lot if the web-server and sql-server are located on different machines. For
memory usage you can win to use the sql-server method, as you will then only
get the translations you need loaded (if you construct a proper SELECT query),
while loading a include file with all the translations will use up more memory
and even more if you happen to use the array method. You can of course chop
the translation files into smaller ones, but that makes a lot extra work as
you will have to keep track of which translations are in which file.
//Aho
Navigation:
[Reply to this message]
|