View Single Post
  #1 (permalink)  
Old 08-11-05, 12:00 AM
harlock harlock is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Question Multiple language support in PHP - best method?

I'm writing a web application from the ground up which needs to support multiple world languages.

My first instinct was to create a language file for each language, which contains all the textual output of the software in each language, defined as constants or variables.

but then I ran into a problem of how do I load it in without massive waste of resources?

If I load it in as a mass of session variables at user login, then there's a copy in RAM for each session. If I load it in as a bunch of regular variables or constants every time a user requests a new page, well, there's a ton of RAM and redundant loading too! Even worse!

Is there some place I can define the language strings as superglobal variables that are loaded into one place in RAM on system boot / PHP startup? Or is there an even better way? I was looking at the superglobal types, and I'm not sure any of them were really built for that purpose.

Thanks,

--Harlock
Reply With Quote