Question

I have an PHP application that I want localized. Currently, the way I'm doing this is a very ugly way: $loc['hello'] = "Hello", echo $loc['hello']; will show Hello, and you can change the file to change the language. What I want is a better way and a faster of doing this, what I'm considering:

  • 1 XML file with language data for all page (will it be slow as every page will load the language data for the entire site)
  • Multiple files, one xml file for each page (not much help as it is just as messy as the old system)
  • gettext() (This seem to be the best way, but I only discovered it today, so will it be hard to change from my current system to this? Is it fast?)

So to summarize, which way is the fastest, the cleanest, and the easiest to move from my current way to the new one. Thanks.

Was it helpful?

OTHER TIPS

A PHP array like the one you already have is pretty fast and clean in my opinion.

Localization itself is ugly to code and manage changes so don't expect that there is a method to make all the pain go away.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top