Change a language string without using the 'Language customisation'

Re: Change a language string without using the 'Language customisation'

by Bob Gilmore -
Number of replies: 0
Picture of Particularly helpful Moodlers

This is freaking ugly and I'm not sure I recommend it but it does work. There may be a tonne of issues with this, including naming collisions, so use at your own risk.

Basically, shrink the font size down to 0 to 'hide' the content, then use the :after pseudo-class to insert new content and reset that contents font size.

/* Set font sizes to 0 to hide strings */
.nav-item[data-key="mycourses"] a, .page-mycourses header h1 { font-size: 0 }

/* Reset font sizes for :after */
.nav-item[data-key="mycourses"] a:after { font-size: 15px; }
.page-mycourses header h1:after { font-size: 30px; }

/* Change the string */
.nav-item[data-key="mycourses"] a:after, .page-mycourses header h1:after { content: "New Course String"; }

Ive had to reset the font size back to 15px / 30px manually, so you will need to tweak this value for each string you need to change (e.g. the link vs heading have different sizes).

You'll need to do this (or something similar) to target each "My Courses" string you want to change.  Use your web browsers element inspector to see what classes / data keys / id's etc are to select them with CSS.

Unrelated: Moodle, what's with using an h2 class on an h1 element? 

Average of ratings: Useful (2)