Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Better to use multiple language files or 1?

From your experience, is it better to use 1 language file or multiple smaller langauge files for each language in a PHP project using the gettext extension? I am not even sure if it is possible to use multiple files, it is hard for me to test since the server caches the language files.

I am doing multiple languages on a social network site, so far just the signup page which is about 1 out of 200 pages to go and it has 35 text strings to translate, at this pace the language file for each language wold be really large so I was thinking maybe it would be better to do different language files for differnt pages or perhaps sections like forums section and blogs section but if it makes no difference then I would ratther not waste my time in making multiple smaller files for each language.

I realize every situation is different and the only real answer is to test it but I am hoping to avoid that this time and just get some oppinions of people more experienced, this is my first time using gettext, thanks

like image 815
JasonDavis Avatar asked Sep 20 '09 03:09

JasonDavis


2 Answers

I would have the language files module based. With gettext you need to specify locale for each language. It would fit best to have a separate .po/.mo files for each module or big parts of your site.

That's my opinion. :-)

like image 136
Kristinn Örn Sigurðsson Avatar answered Nov 16 '22 12:11

Kristinn Örn Sigurðsson


I typically automate the process and have multiple languages in multiple files by using a database to edit the site (using a simple db lookup). This lets me hire translators to come in and verify the current translation easily. Deploying to production then is simply turning the database into a set of language files.

like image 2
MathGladiator Avatar answered Nov 16 '22 12:11

MathGladiator