Moodle
  1. Moodle
  2. MDL-19546

get_string('modulenameplural', 'user') does not exist in lang files.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.9.5
    • Fix Version/s: None
    • Component/s: Global search
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      5358

      Description

      For example, get_string('modulenameplural', 'wiki') exists in lang/en_utf8/wiki.php as $string['modulenameplural'] = 'Wikis';

      But, module name 'user' which means user-profile and blog does not have lang file.

      ---------------------(original sourse)-from here
      (1) search/query.php
      foreach($module_types as $mod) {
      if ($mod == $adv->module) {
      if ($mod != 'all')

      { print "<option value='$mod' selected=\"selected\">".get_string('modulenameplural', $mod)."</option>\n"; }

      else

      { print "<option value='$mod' selected=\"selected\">".get_string('all', 'search')."</option>\n"; }

      }
      else {
      if ($mod != 'all')

      { print "<option value='$mod'>".get_string('modulenameplural', $mod)."</option>\n"; }

      else

      { print "<option value='$mod'>".get_string('all', 'search')."</option>\n"; }

      }
      }
      -------
      (2) search/stats.php

      $table->data[] = array($documentsindatabasestr, $indexinfo->dbcount);

      foreach($indexinfo->types as $key => $value)

      { $table->data[] = array(get_string('documentsfor', 'search') . " '".get_string('modulenameplural', $key)."'", $value); }


      ---------------------(original sourse)-to here

      There are several solutions.

      (1) add user.php in lang folder (for global search only...).
      (2) make an exception the module names which does not exist in lang folder.
      (3) make an exception the module names which does not exist in lang folder and change module name 'user' to 'user' and 'blog'.

      My suggestion is that newly adding a function to get 'modulenameplural'.

      for example, add to search/lib.php

      function get_modulenameplural($modname)
      {
      if (($ret = get_string('modulenameplural', $modname)) != '[[modulenameplural]]') return $ret;
      return get_string("modulenameplural_$modname", 'search');
      }

      and replace get_string('modulenameplural', $mod) to get_modulenameplural($mod) in search/query.php and search/stats.php.

        Activity

        Tatsuya Shirai created issue -
        Martin Dougiamas made changes -
        Field Original Value New Value
        Workflow jira [ 32406 ] MDL Workflow [ 45061 ]
        Martin Dougiamas made changes -
        Workflow MDL Workflow [ 45061 ] MDL Full Workflow [ 73418 ]
        Dan Poltawski made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Won't Fix [ 2 ]

          People

          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: