Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-27073

Support multi-language content in custom menu

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.0.4
    • 2.0
    • Accessibility
    • None
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE
    • MDL-27073_multilang-custommenu
    • Hide
      • Install another language pack to the site (for example Czech - Čeština "cs")
      • Enable multi/language filter (content filtering is enough)
      • Go to Site administration > Appearance > Themes > Theme settings and define the custom menu using a multi-lang syntax (see my comments below for some example using the English/Czech variants of the menu)
      • TEST: make sure that when switching the language, you get relevant custom menu displayed
      Show
      Install another language pack to the site (for example Czech - Čeština "cs") Enable multi/language filter (content filtering is enough) Go to Site administration > Appearance > Themes > Theme settings and define the custom menu using a multi-lang syntax (see my comments below for some example using the English/Czech variants of the menu) TEST: make sure that when switching the language, you get relevant custom menu displayed

      When we are using the new "custommenuitems", we should have the possibility to create the menu for different languages, since we are able to localize everything else.

      1) We could use a notation like this:

      [en-US:Moodle community;pt-PT:Comunidade Moodle]|http://moodle.org
      -[en-US:Moodle free support;pt-PT:Suporte gratuito do Moodle]|http://moodle.org/support
      -[en-US:Moodle development;pt-PT:Desenvolvimento do Moodle]|http://moodle.org/development

      by adding in /lib/outputcomponents.php (around line 2386) something like:
      if (!array_key_exists(0, $bits) || empty($bits[0]))

      { // Every item must have a name to be valid continue; }

      else {
      $bits[0] = ltrim($bits[0],'-');

      + $languages = explode(';', $bits[0]); // pt:nome;en:name|url|title|sort
      + if (array_key_exists(0, $languages)) {
      + foreach ($languages as $language)

      { + $menulang = explode(':', $language); + if ($menulang[0] == current_language() ) + $bits[0] = $menulang[1]; + }

      + }

      2) or using the multilang plugin by adding in /lib/outputcomponents.php (around line 2372) something like:
      public static function convert_text_to_menu_nodes($text) {
      + $text = format_text($text, $format=FORMAT_MARKDOWN, $options=NULL, $courseid=NULL);

      With this line we could use the following syntax to the custommenu text:
      <span lang="en" class="multilang">
      Home|http://moodleurl
      -blah|blahlink
      </span>
      <span lang="pt" class="multilang">
      Início|http://moodleurl
      -blah|blahlink
      </span>

            mudrd8mz David Mudrák (@mudrd8mz)
            rodolfo.matos Rodolfo Matos
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Marina Glancy Marina Glancy
            Votes:
            6 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.