phpmultilingualpomo

PHP multilingual site with mo


I want to make a site available in three languages, in my knowledge I can use three way to achieve this.

  1. With .po and .mo file like wordpress.
  2. With php array dumping in html file.
  3. With storing a labels in database.

    The database may be increase with large amount of data.

My Question is what is the fastest and better way for translating site labels in these three options.

Thanks in advance.


Solution

    1. gettext (using .po and .mo files) is the classic, stable, proven solution with a vibrant ecosystem, having been built up over years and years, designed for the exact purpose of translation, supporting virtually everything you will eventually figure out that you need (plurals, categories, asynchronous workflow, you name it).
    2. Is a poor man's solution which scales up to a few dozen strings to translate and becomes a nightmare to maintain after that. It has no tools to support the workflow, you'll have to reinvent every wheel you'll encounter eventually.
    3. Is 2. with the added disadvantage of not easily being able to version control your translations.

    Use an established solution, the problem is not as trivial as it may seem initially. gettext is good, though you'll really need to get into the workflow, which may be a bit of an uphill battle in the beginning.