Merge branch 'MDL-76537_401' of https://github.com/stronk7/moodle into MOODLE_401_STABLE

This commit is contained in:
Jun Pataleta 2023-01-19 11:23:51 +08:00
commit 396fff3d0b
2 changed files with 29 additions and 16 deletions

View File

@ -0,0 +1,29 @@
@core @core_calendar
Feature: Verify that the day and month names are displayed using UTF-8
In order to be able to use the calendar using different languages
As a user
I need to see the day and month names displayed properly
Background:
Given remote langimport tests are enabled
Scenario Outline: View the calendar for December 2012 with correct UTF-8
Given I log in as "admin"
And I navigate to "Language > Language packs" in site administration
And I set the field "Available language packs" to "<lang>"
And I press "Install selected language pack(s)"
And I should see "Language pack '<lang>' was successfully installed"
And I follow "Preferences" in the user menu
And I follow "Preferred language"
And I set the field "Preferred language" to "<lang>"
And I press "Save changes"
When I view the calendar for "12" "2022"
Then I should see "<month>"
And I should see "<day>"
Examples:
| lang | month | day |
| en_ar | December | Sat |
| es | diciembre | Sáb |
| fr | décembre | Sa |
| ru | декабря | Сб |

View File

@ -2362,18 +2362,6 @@ function userdate_htmltime($date, $format = '', $timezone = 99, $fixday = true,
* @since Moodle 2.3.3
*/
function date_format_string($date, $format, $tz = 99) {
global $CFG;
$localewincharset = null;
// Get the calendar type user is using.
if ($CFG->ostype == 'WINDOWS') {
$calendartype = \core_calendar\type_factory::get_calendar_instance();
$localewincharset = $calendartype->locale_win_charset();
}
if ($localewincharset) {
$format = core_text::convert($format, 'utf-8', $localewincharset);
}
date_default_timezone_set(core_date::get_user_timezone($tz));
@ -2391,10 +2379,6 @@ function date_format_string($date, $format, $tz = 99) {
$datestring = core_date::strftime($format, $date);
core_date::set_default_server_timezone();
if ($localewincharset) {
$datestring = core_text::convert($datestring, $localewincharset, 'utf-8');
}
return $datestring;
}