- Posts: 6598
- Karma: 162
- Thank you received: 322
- Community Forum
- Appointment Booking Pro - Retired, no longer for sale or supported.
- Errors and Error Messages
- Not translating day/month names
Not translating day/month names
- ABPro Support
- Topic Author
- Offline
- Moderator
Less
More
11 years 8 months ago - 9 years 5 months ago #12243
by ABPro Support
Not translating day/month names was created by ABPro Support
ABPro does not translate day/month names
PHP and MySQL do day/month name translation.
ABPro passes the language code, it reads from your Joomla, to the setlocale() php function.
Once that is done, any php Date() functions will return the day/month names in the correct language.
ABPro used MySQL's lc_time_names call to do the same for database calls. MySQL decides what day/month name to send back.
The translation takes place automatically and requires nothing to be done on your part. If you set your site language to French. ABPro's dates will display with French day/month names.
Some sites/languages seem to not set properly. I cannot say why as I have never been able to reproduce the issue.
#EDIT September 2014 #
One of these two items seem to fix it most of the time.
$lang =& JFactory::getLanguage();
setlocale(LC_TIME, str_replace("-", "_", $lang->getTag()));
Add red code to specify utf-8
setlocale(LC_TIME, str_replace("-", "_", $lang->getTag()).".UTF8");
If you have Time on Y-Axis = Yes, you will need to add the same mod to file gad_ajax2.php.
Change
setlocale(LC_TIME, str_replace("-", "_", $lang->getTag()));
to
setlocale(LC_TIME,"swedish");
Names can be found here..
msdn.microsoft.com/en-ca/library/39cwe7zf(v=vs.80).aspx
If your site is not translating and you have set the Joomla language, you might try hard coding the language code.
In file ABPro file gad_ajax.php around line 57 look for:
$lang =& JFactory::getLanguage();
setlocale(LC_TIME, str_replace("-", "_", $lang->getTag()));
Change to your language code (the example sets to de_DE for German)
setlocale(LC_TIME, "de_DE");
The above code snippet only works if you have Time on Y-Axis = No.
If yours is set to yes, you might try the same change in file gad_ajax2.php as that is the file that builds the grid if you have Time on Y-Axis =Yes
See also, the manual entry on php setloacle(), there are some other paramenters that may help.
php.net/manual/en/function.setlocale.php
### UPDATE ###
Windows servers want the name not the code for a php setlocale.
Change
setlocale(LC_TIME, str_replace("-", "_", $lang->getTag()));
to
setlocale(LC_TIME,"swedish");
Names can be found here..
msdn.microsoft.com/en-ca/library/39cwe7zf(v=vs.80).aspx
### ANOTHER UPDATE ###
For Swedish, on a Linux server see
appointmentbookingpro.com/component/kune...mid=0&start=12#13873
### ANOTHER UPDATE ###
Greek is a problem, this works on a Linux server..
setlocale(LC_TIME, array('el_GR.UTF-8','el_GR','greek'));
If the case of dates in SQL queries, ABPro passes the Joomla language code to MySQL in an lc_time_names call and MySQL returns the correct translation.
Again also, normally this all works without any intervention by you as long as the Joomla language code is set correctly.
You can try hard coding the call. For the confirmation messages edit file:
\administrator\components\com_rsappt_pro2\sendmail_pro2.php
Search for:
$sql = "SET lc_time_names
You will find 3 occurrences. Change the call to hard code your language code.
For more info on lc_time_names see
dev.mysql.com/doc/refman/5.0/en/locale-support.html
Additionally, if some charters are not displaying correctly..
The data sent to the client is treated slightly different on a Windows server vs Linux. ABPro tries to determine which it is running on but may not be setting the WINDOWS directive correctly on your site.
In file \components\com_rsappt_pro2\rsappt_pro2.php
Around line 29 look for:
if (substr(PHP_OS, 0, 3) == 'WIN') {
define("WINDOWS", true);
} else {
define("WINDOWS", false);
}
Try just hard coding one way then the other to see which works.
For example:
//if (substr(PHP_OS, 0, 3) == 'WIN') {
//define("WINDOWS", true);
//} else {
define("WINDOWS", false);
//}
PHP and MySQL do day/month name translation.
ABPro passes the language code, it reads from your Joomla, to the setlocale() php function.
Once that is done, any php Date() functions will return the day/month names in the correct language.
ABPro used MySQL's lc_time_names call to do the same for database calls. MySQL decides what day/month name to send back.
The translation takes place automatically and requires nothing to be done on your part. If you set your site language to French. ABPro's dates will display with French day/month names.
Some sites/languages seem to not set properly. I cannot say why as I have never been able to reproduce the issue.
#EDIT September 2014 #
One of these two items seem to fix it most of the time.
In file ABPro file gad_ajax.php around line 78 look for:
$lang =& JFactory::getLanguage();
setlocale(LC_TIME, str_replace("-", "_", $lang->getTag()));
Add red code to specify utf-8
setlocale(LC_TIME, str_replace("-", "_", $lang->getTag()).".UTF8");
If you have Time on Y-Axis = Yes, you will need to add the same mod to file gad_ajax2.php.
If you are running a Windows server you need to spell out the language..
Change
setlocale(LC_TIME, str_replace("-", "_", $lang->getTag()));
to
setlocale(LC_TIME,"swedish");
Names can be found here..
msdn.microsoft.com/en-ca/library/39cwe7zf(v=vs.80).aspx
If neither of the above fixed the problem, read on...
If your site is not translating and you have set the Joomla language, you might try hard coding the language code.
In file ABPro file gad_ajax.php around line 57 look for:
$lang =& JFactory::getLanguage();
setlocale(LC_TIME, str_replace("-", "_", $lang->getTag()));
Change to your language code (the example sets to de_DE for German)
setlocale(LC_TIME, "de_DE");
The above code snippet only works if you have Time on Y-Axis = No.
If yours is set to yes, you might try the same change in file gad_ajax2.php as that is the file that builds the grid if you have Time on Y-Axis =Yes
See also, the manual entry on php setloacle(), there are some other paramenters that may help.
php.net/manual/en/function.setlocale.php
### UPDATE ###
Windows servers want the name not the code for a php setlocale.
Change
setlocale(LC_TIME, str_replace("-", "_", $lang->getTag()));
to
setlocale(LC_TIME,"swedish");
Names can be found here..
msdn.microsoft.com/en-ca/library/39cwe7zf(v=vs.80).aspx
### ANOTHER UPDATE ###
For Swedish, on a Linux server see
appointmentbookingpro.com/component/kune...mid=0&start=12#13873
### ANOTHER UPDATE ###
Greek is a problem, this works on a Linux server..
setlocale(LC_TIME, array('el_GR.UTF-8','el_GR','greek'));
If the case of dates in SQL queries, ABPro passes the Joomla language code to MySQL in an lc_time_names call and MySQL returns the correct translation.
Again also, normally this all works without any intervention by you as long as the Joomla language code is set correctly.
You can try hard coding the call. For the confirmation messages edit file:
\administrator\components\com_rsappt_pro2\sendmail_pro2.php
Search for:
$sql = "SET lc_time_names
You will find 3 occurrences. Change the call to hard code your language code.
For more info on lc_time_names see
dev.mysql.com/doc/refman/5.0/en/locale-support.html
Additionally, if some charters are not displaying correctly..
The data sent to the client is treated slightly different on a Windows server vs Linux. ABPro tries to determine which it is running on but may not be setting the WINDOWS directive correctly on your site.
In file \components\com_rsappt_pro2\rsappt_pro2.php
Around line 29 look for:
if (substr(PHP_OS, 0, 3) == 'WIN') {
define("WINDOWS", true);
} else {
define("WINDOWS", false);
}
Try just hard coding one way then the other to see which works.
For example:
//if (substr(PHP_OS, 0, 3) == 'WIN') {
//define("WINDOWS", true);
//} else {
define("WINDOWS", false);
//}
Last edit: 9 years 5 months ago by Rob.
The following user(s) said Thank You: Putois
Please Log in to join the conversation.
- Community Forum
- Appointment Booking Pro - Retired, no longer for sale or supported.
- Errors and Error Messages
- Not translating day/month names
Time to create page: 0.097 seconds