|
Posted by Mike P2 on 04/28/07 17:26
On Apr 23, 2:05 am, FFMG <FFMG.2ph...@no-mx.httppoint.com> wrote:
> Hi,
>
> I would like to add international support for my site to allow some of
> my users to translate the site if they really feel the urge to do it.
>
> So, what is the best way, so far, of handling languages?
I think phpBB and similar use files for language for portability and
ease of updating. I would save smaller strings (like messages, link
text, page titles) into a database and retrieve the needed language on
each page. I think SQL caching should be effective here because each
language should use the same query every time.
If you think it would be faster, you can save it in both the database
and into files (into a PHP file, with array assignments), and each
time it needs to be updated the form is filled with data from the
database, and then when the form is submitted the data would be
updated in the database and the language file would be regenerated
with that new data. Then the files that use the language would include
the appropriate language file instead of querying the database each
time (useful if the table gets big and the queries start taking too
long). I've benchmarked with 100 rows of data and 100 files, and found
that retrieving an indexed row from the database is about twice as
fast as reading the file named with that index. I've been told that
the database would be even faster in comparison if there were more
files and rows.
-Mike PII
[Back to original message]
|