MDL-78983 core: Preserve default behaviour of flipping question icon

Introduce a lang string `questioniconfollowlangdirection` that will
allow the current behaviour of displaying the question mark icon
in RTL languages in the same manner as the current language.
This commit is contained in:
Jun Pataleta
2023-08-11 16:11:05 +07:00
committed by Huong Nguyen
parent b201bcb878
commit 88459bba94
2 changed files with 7 additions and 4 deletions
+4 -2
View File
@@ -41,8 +41,10 @@ $string['oldcharset'] = 'ISO-8859-1';
$string['parentlanguage'] = '';
$string['pm'] = 'pm';
$string['pmcaps'] = 'PM';
// Direction of the question mark icon for this language. Set to 'rtl' if the language needs to display it in right-to-left.
$string['questionicondirection'] = 'ltr';
// Whether the question icon follows the language direction.
// E.g. In some RTL languages, like Arabic, it needs to be set to 'yes' so the question mark is flipped.
// But for Hebrew, the question mark character is not flipped, so it needs to be set to 'no'.
$string['questioniconfollowlangdirection'] = 'yes';
$string['strftimedate'] = '%d %B %Y';
$string['strftimedatemonthabbr'] = '%d %b %Y';
$string['strftimedatemonthtimeshort'] = '%d %b %Y, %I:%M';
@@ -497,8 +497,9 @@ class icon_system_fontawesome extends icon_system_font {
$data['aria-hidden'] = $icon->attributes['aria-hidden'];
}
// Flip the orientation of the question mark if the value of the `questionicondirection` lang config string is set to `rtl`.
if (strpos($data['key'], 'fa-question') !== false && get_string('questionicondirection', 'langconfig') === 'rtl') {
// Flip question mark icon orientation when the `questioniconfollowlangdirection` lang config string is set to `yes`.
$isquestionicon = strpos($data['key'], 'fa-question') !== false;
if ($isquestionicon && right_to_left() && get_string('questioniconfollowlangdirection', 'langconfig') === 'yes') {
$data['extraclasses'] = "fa-flip-horizontal";
}