Date format per language
Posted: 24 Apr 2019, 13:30
Hello.
I would like to set the date format depending on the global variable "g_active_language "(suposed it stores the user language for each request). I tried the following code in "custom_strings.inc.php", but nothing happened, so I supposed at this point, "g_active_language" is defined, but it is being overriden later, as well as the rest of the variables inside the "switch" ("s_" sub-fixed) has the right values.
I also tried the same code in "config_inc.php", and it fail reporting "g_active_language" is undefined, so I have to suppose when this file is loaded, "g_active_language" is not defined yet.
Where can I write this piece of code to get the expected result?
Thanks.
I would like to set the date format depending on the global variable "g_active_language "(suposed it stores the user language for each request). I tried the following code in "custom_strings.inc.php", but nothing happened, so I supposed at this point, "g_active_language" is defined, but it is being overriden later, as well as the rest of the variables inside the "switch" ("s_" sub-fixed) has the right values.
Code: Select all
switch($g_active_language){
case 'spanish':
$g_normal_date_format = 'd-m-Y H:i:s';
$g_short_date_format = 'd-m-y';
$g_complete_date_format = 'D d-M-Y H:i:s';
break;
default:
}
Where can I write this piece of code to get the expected result?
Thanks.