I am working on an app to make it international, i.e., English & German (for right now). And I am mulling over the best way to do this.
One approach would be to include a file that contains all the defines for each word or phrase, e.g.,
define (df_LANGUAGE, "ENG");
/ define (df_LANGUAGE, "GER"); /
and then doing something like:
if (df_LANGUAGE == "ENG")
{
define (df_NAME, "Name");
define (df_STREET, "Street");
define (df_CITY, "City");
define (df_STATE, "State");
}
else
{
define (df_NAME, "Namen");
define (df_STREET, "Strause");
define (df_CITY, "Stadt");
define (df_STATE, "Staat");
}
The appropriate phrase will then be used, depending upon the language (in this case, English).
The other method would be to delare all of these as session variables, which would make them available to each page.
My question is, which method is faster -- including this file for every page that needs it (which would be most if not all of them), or using sessions? Both have some overhead, but I don't know which method has more overhead than the other.
For an application written in, e.g., Visual Basic, I would just throw all this info into a class and then pick the correct set of terms. But I don't know much about PHP classes, and they seem to be limited to just one page at at time anyway, just like local variables are.