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

Plugins (such as H5P) who have camelCase language strings updating to amos strings

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.7
    • Fix Version/s: None
    • Component/s: Language
    • Labels:
    • Affected Branches:
      MOODLE_37_STABLE

      Description

      We have seen cases where users of H5P who have had versions prior to 1.20, language strings were camelCase, whereas in 1.20.0 (H5P) this was moved to amos compatible lower-case only language strings.

      The impact to this, breaks language packs as the LMS is expecting exact matches

      This was found in the language pack file: h5p.php 

      https://github.com/h5p/h5p-moodle-plugin/commit/e3e340043acbbda0521718738c9b04e35a3ead8a

       

      The fix, to not only handle the case change, We found that here:

      admin\tool\customlang\locallib.php

      On lines 144 we add:

      $lcurrent = array_change_key_case($current, CASE_LOWER);
      if (isset($current[$stringid]) || isset($lcurrent[$stringid])) {
           $current[$stringid] = !isset($current[$stringid]) ? $lcurrent[$stringid] :    $current[$stringid];
      

       

      Where now, the checks is against mixed case language strings, and then returns the mixed case string (and updates the existing string with the new name). 

       

      As per:

      https://github.com/dustinbrisebois/moodle/commit/57a523c459638375b75c67fe7ca62e8de974a7ba

       

       

      Adding:

       

      on line 171 where:

      if (is_null($current[$stringid]->local) && $stringmaster !== $stringlocal) {

       

      Adds and additional check against unnecessary DB updates – if the local is empty don't run the update. 

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              dustinbrisebois Dustin Brisebois
              Participants:
              Component watchers:
              cameron1729, David Mudrák (@mudrd8mz), Helen Foster
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: