Hello everyone
I wanted to ask if it was possible to include a certificate containing the names of the months in Italian or other languages, in fact, when users of the platform shall obtain a certificate is always given in English.
Can you tell me if there is any setting that I need to change or which file should I change to insert the translations?
Thanks for the tips
There are two places that determine the format of the date:
// Date formatting - can be customized if necessary
$certificatedate = '';
if ($certrecord->certdate > 0) {
$certdate = $certrecord->certdate;
}else $certdate = certificate_generate_date($certificate, $course);
if($certificate->printdate > 0) {
if ($certificate->datefmt == 1) {
$certificatedate = strftime('%e. %B %Y', $certdate);
} if ($certificate->datefmt == 2) {
$certificatedate = strftime('%e. %b %Y', $certdate);
} if ($certificate->datefmt == 3) {
$certificatedate = strftime('%Y-%m-%d', $certdate);
} if ($certificate->datefmt == 4) {
$certificatedate = strftime('%A, den %e. %B %Y', $certdate);
} if ($certificate->datefmt == 5) {
$timeformat = get_string('strftimedate');
$certificatedate = userdate($certdate, $timeformat);
}
}
The lines if ($certificate->datefmt == 1)... check with option has been picked from the combo-box.
strftime is a standard php-function that formats the date using %-parameters.
The lines for the 5th option use the standard date format from the moodle installation.
Of course, the moodle installation must be configured to use the italian locale.
- You pick a date format in the certificate editing window (combo-box)
- According to the selection in #1, the date is formatted using php-code in certificate.php of your certificate type. In the standard types there is a date formatting section at the beginning.
// Date formatting - can be customized if necessary
$certificatedate = '';
if ($certrecord->certdate > 0) {
$certdate = $certrecord->certdate;
}else $certdate = certificate_generate_date($certificate, $course);
if($certificate->printdate > 0) {
if ($certificate->datefmt == 1) {
$certificatedate = strftime('%e. %B %Y', $certdate);
} if ($certificate->datefmt == 2) {
$certificatedate = strftime('%e. %b %Y', $certdate);
} if ($certificate->datefmt == 3) {
$certificatedate = strftime('%Y-%m-%d', $certdate);
} if ($certificate->datefmt == 4) {
$certificatedate = strftime('%A, den %e. %B %Y', $certdate);
} if ($certificate->datefmt == 5) {
$timeformat = get_string('strftimedate');
$certificatedate = userdate($certdate, $timeformat);
}
}
The lines if ($certificate->datefmt == 1)... check with option has been picked from the combo-box.
strftime is a standard php-function that formats the date using %-parameters.
The lines for the 5th option use the standard date format from the moodle installation.
Of course, the moodle installation must be configured to use the italian locale.
Hi Raymond
thanks for the reply.
Maybe I did not understand everything you wrote
In the date format, in the certificate editing window (combo-box) I made this selection (see picture)
Italian is the language of the platform, but the months I still see them in English
Can you tell me the location of the file to edit?
Thanks
thanks for the reply.
Maybe I did not understand everything you wrote
In the date format, in the certificate editing window (combo-box) I made this selection (see picture)
Italian is the language of the platform, but the months I still see them in English
Can you tell me the location of the file to edit?
Thanks
Take a peek into
%yourmoodledir%/mod/certificate/type/%yourfavouritecertificatetype%/certificate.php
Date formatting is defined at the beginning of this file.
Can your users choose their language?
Is your moodle server operating with an italian locale?
Is your web server operating with an italian locale?
%yourmoodledir%/mod/certificate/type/%yourfavouritecertificatetype%/certificate.php
Date formatting is defined at the beginning of this file.
Can your users choose their language?
Is your moodle server operating with an italian locale?
Is your web server operating with an italian locale?
I found the file certificate.php
}
// Date formatting - can be customized if necessary
$certificatedate = '';
if ($certrecord->certdate > 0) {
$certdate = $certrecord->certdate;
}else $certdate = certificate_generate_date($certificate, $course);
if($certificate->printdate > 0) {
if ($certificate->datefmt == 1) {
$certificatedate = str_replace(' 0', ' ', strftime('%B %d, %Y', $certdate));
} if ($certificate->datefmt == 2) {
$certificatedate = date('F jS, Y', $certdate);
} if ($certificate->datefmt == 3) {
$certificatedate = str_replace(' 0', '', strftime('%d %B %Y', $certdate));
} if ($certificate->datefmt == 4) {
$certificatedate = strftime('%B %Y', $certdate);
} if ($certificate->datefmt == 5) {
$timeformat = get_string('strftimedate');
$certificatedate = userdate($certdate, $timeformat);
}
}
My users can't choose their language
To these questions I have no answer
Is your moodle server operating with an italian restaurant?
Is your web server, operating with an italian restaurant?
Where can I check?
Language configuration on your pictures look good to me.
Maybe it is not a language issue in your moodle, but on the computer your moodle runs on.
Check the settings of the operation system of the computer that you have installed your moodle onto (or ask the administrator in charge of it). Many tools and applications determine the language settings of the os and use those for themselves.
Moodle uses its own system to store local format settings, but it also uses a standard php-function to actually turn a %m into "February". The php-interpreter or other parts of your server might have own language settings or use the language setting of the operating system.
By the way:
Do english month names appear only on your certificates or on other parts of moodle as well? (such as log reports)
Maybe it is not a language issue in your moodle, but on the computer your moodle runs on.
Check the settings of the operation system of the computer that you have installed your moodle onto (or ask the administrator in charge of it). Many tools and applications determine the language settings of the os and use those for themselves.
Moodle uses its own system to store local format settings, but it also uses a standard php-function to actually turn a %m into "February". The php-interpreter or other parts of your server might have own language settings or use the language setting of the operating system.
By the way:
Do english month names appear only on your certificates or on other parts of moodle as well? (such as log reports)
Thanks Raymond
I'll try to ask the administrator
The month names in English only appear on the certificates
and not on other parts of moodle
I'll try to ask the administrator
The month names in English only appear on the certificates
and not on other parts of moodle
Raymond, your post here has helped me hugely.
Thanks!