I’m posting this question on it’s own as I found post one which lacks full explanation or the best way to do it.
Should I use a language file to name items like:
$first_name= ‘name’; $last_name = ‘last_name’;
and then include this file depending on selection?
I have an app which I need to have in two languages.
Will like something in this lines:
http://www.myapp.com/?lang=en http://www.myapp.com/?lang=es
Should I use a constants file for this purpose?
constants.php
define(‘OPERATION_NOT_ALLOWED_EN’, ‘This operation is not allowed!’);
define(‘OPERATION_NOT_ALLOWED_ES’, ‘This operation is not allowed!’);
What is the recommended way of accomplishing this?
You can follow in the footsteps of phpBB – they use a
$lang[]array with code that looks like:It is of course included from a file specified in the user’s settings, but you’d be fine with your suggestion of
?lang=enin the query string accessing something similar to aconstants.phpfile.You might want to name the file
lang_en.phpor something similar for clarity.