Custom theme needs language support

Custom theme needs language support

by Patrick Malley -
Number of replies: 1
I have created a custom theme that has an HTML menu bar that appears in the header on the front page. Recently, someone brought up the issue that this "static" menu poses to multilingual sites.

What I have currently:

A static menu of options that can only appear in the language that it is typed. If a user selects an alternate language from the drop-down, the menu does not change.

What I would like to do:

I would like to use PHP to generate the items in this menu so that they will change with the language pack selected by the user.

Is this possible? If so, where would I find the hooks for such a thing?
Average of ratings: -
In reply to Patrick Malley

Re: Custom theme needs language support

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
header.html inside your theme is actually parsed as PHP, so you can do whatever you like inside there, and access any of the standard moodle library functions. And if you need that level of complication, you could create some other PHP files (e.g. lib.php) inside your theme folder, and include them. And if you need other lang strings, you can create a new language file lang/en_utf8_local/my_theme_strings.php, and get those strings using get_string('stringkey', 'my_theme_strings');