Skip to content

Commit

Permalink
MDL-78983 core: Preserve default behaviour of flipping question icon
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
junpataleta authored and HuongNV13 committed Aug 11, 2023
1 parent cef4a4e commit c6817e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lang/en/langconfig.php
Expand Up @@ -41,8 +41,10 @@
$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';
Expand Down
5 changes: 3 additions & 2 deletions lib/classes/output/icon_system_fontawesome.php
Expand Up @@ -501,8 +501,9 @@ public function render_pix_icon(renderer_base $output, pix_icon $icon) {
$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";
}

Expand Down

0 comments on commit c6817e4

Please sign in to comment.