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

Translating course logs

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.2.4
    • None
    • Usability
    • None
    • linux php postgresql apache
    • MOODLE_22_STABLE
    • Hide

      /* Custom start */

      $modules = $DB->get_records_menu('modules', array(),'','name,id');
      foreach($modules as $modulename=>$moduleid){
      $modulenames[] =$modulename;
      }
      if(in_array($log->module, $modulenames)){
      $langfile = $log->module;
      $strmodule = get_string("pluginname",$langfile);
      } else{
      $langfile = "moodle";
      $strmodule = get_string("$log->module");
      }
      $stractionfirst = str_replace(' ', '', $log->action);
      $straction = get_string($stractionfirst,$langfile);
      if( strpos($straction,'[') ){
      $straction = get_string($stractionfirst);
      }
      $displayaction="$straction $strmodule";
      /* Custom end */
      // original code
      // $displayaction="$log->module $log->action";

      Of course this line : $stractionfirst = str_replace(' ', '', $log->action); glues together two terms and this causes the term never being found, here we need a solution.

      Show
      /* Custom start */ $modules = $DB->get_records_menu('modules', array(),'','name,id'); foreach($modules as $modulename=>$moduleid){ $modulenames[] =$modulename; } if(in_array($log->module, $modulenames)){ $langfile = $log->module; $strmodule = get_string("pluginname",$langfile); } else{ $langfile = "moodle"; $strmodule = get_string("$log->module"); } $stractionfirst = str_replace(' ', '', $log->action); $straction = get_string($stractionfirst,$langfile); if( strpos($straction,'[') ){ $straction = get_string($stractionfirst); } $displayaction="$straction $strmodule"; /* Custom end */ // original code // $displayaction="$log->module $log->action"; Of course this line : $stractionfirst = str_replace(' ', '', $log->action); glues together two terms and this causes the term never being found, here we need a solution.
    • Hide

      Add another language pack than English.
      Create a course.
      Configure the course to the other language than English.
      Navigate into the course to create some logs
      See the course logs
      They are presented in plain english and not in the other course language, (eg. portuguese)

      Show
      Add another language pack than English. Create a course. Configure the course to the other language than English. Navigate into the course to create some logs See the course logs They are presented in plain english and not in the other course language, (eg. portuguese)

    Description

      Hi

      Today to see his course log a non-english speaker will see the terms of the action collumn in english wich in terms of usability is not the best way to present the logs.

      Is there any plan to translate the logs ?

      I just try it with the help of get_string to look in the apropiate module file, but it fails in some terms like closeattempt, deletemod and others i could not find and as a result the term end not being translated.

      Here is the code we try to aply, in the course/lib.php file.

      If some one like the idea and can see any way to fully translate the course logs it would be apreciated.

      /* Custom start */

      $modules = $DB->get_records_menu('modules', array(),'','name,id');
      foreach($modules as $modulename=>$moduleid){
      $modulenames[] =$modulename;
      }
      if(in_array($log->module, $modulenames)){
      $langfile = $log->module;
      $strmodule = get_string("pluginname",$langfile);
      } else{
      $langfile = "moodle";
      $strmodule = get_string("$log->module");
      }
      $stractionfirst = str_replace(' ', '', $log->action);
      $straction = get_string($stractionfirst,$langfile);
      if( strpos($straction,'[') ){
      $straction = get_string($stractionfirst);
      }
      $displayaction="$straction $strmodule";
      /* Custom end */
      // original code
      // $displayaction="$log->module $log->action";

      Of course this line : $stractionfirst = str_replace(' ', '', $log->action); glues together two terms and this causes the term never being found, here we need a solution.

      Cheers

      Attachments

        Issue Links

          Activity

            People

              moodle.com Moodle HQ
              amrigo Angelo Rigo
              Huong Nguyen, Barbara Ramiro, Bas Brands, Mathew May, David Woloszyn, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: