gr3g
gr3g

Reputation: 2914

handle translation of website

I finished my website and want to translate it in 3 other languages.
The question is not how to translate it, but how to handle the different languages, when you don't use a CMS.

I have all my script with English text in it.
I'm able to translate it in Dutch, French and German, so I'll have 3 folders: 1 folder for each language.
The problem is when I wan't to upgrade the website:
If I change code from the English folder, I'd like to juste copy-and-paste this code for the 3 other languages.
Problem is that I will always have to retranslate it to 3 other languages again.

How do big websites handle translation?
Having multiple folders, with every folder = 1 language, is the way to proceed?
Text coming from database is a better solution? With a table for each language?

Upvotes: 0

Views: 428

Answers (1)

Cr41s3
Cr41s3

Reputation: 97

Make a function with the parameters: string code, language So for example: translate('error_1','de_DE'); that "would" return an specified error in German. So you could create 3 .csv files with all the strings you would need.

And having multiple folders is rubbish. On the bis pages it just seems as they use different folders but the "folder" is handled via. .htaccess and is changed to i.e. index.php?page=main&language=de_DE

Upvotes: 1

Related Questions