Automattic/sensei

Wrap Question Number in span tag

Opened this issue · 0 comments

Steps to Reproduce

Quiz questions are no longer translating using TranslatePress so the request is to wrap the question number within the h2 heading that outputs the question title, in a span tag.

We are using a translation plugin (TranslatePress) which is fairly popular. We ran into an issue which, in the interest of time, we had just resolved by modifying the /woothemes-sensei/plugins/sensei-lms/includes/class-sensei-question.php file to wrap the output of the question number ($title_html .= sprintf( esc_html__( '%d. ', 'sensei-lms' ), sensei_get_the_question_number() );) in a span tag.

The reason for the request is that the translation plugin identifies the entire content, including the number, as a string so it wasn't finding our 100+ question translations because prior to a year or so I go I guess now, Sensei didn't output the question numbers. We also, FYI use the random order feature so it would be very daunting to re-translate every possible combination of numbers and questions in the translation file/plugin.

PHP / WordPress / Sensei LMS version

WP 6.5.4 / Sensei LMS 4.24.1