Building a multi-language site?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

The way we've done it in Blacknova Traders is by doing language strings.

So, for example, to display:

"Planetary beams have destroyed X points of armor"

we do:

Code: Select all

$l_cmb_destroyedyourarmor       = 'Planetary beams have destroyed їcmb_planetbeams] points of armor';
Then we run a str_replace on [cmb_planetbeams], replacing it with the points of armor destroyed.

In other languages, it looks like:

Code: Select all

$l_cmb_destroyedyourarmor       = &quote;Los láseres planetarios destruyeron їcmb_planetbeams] puntos de blindaje&quote;;
That way, you get the full context of the sentence, you get full language translation, and you also get the values you need.

As a result, we have a collection of files that are just that - a collection of variable/text assignments, and we only include a few lang files per gamecode file, reducing the memory overhead. It also helps translators, because they have managable sized files to work with.
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

Post by Phoenixheart »

Yeah, thanks to Vietnamese hongco, it's a good idea.
But in the case of whole site? Why do you think it's that difficult? :(
Post Reply