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

Using a language pack with a underscore its name breaks H5P content bank

XMLWordPrintable

    • MOODLE_39_STABLE
    • MOODLE_39_STABLE
    • MDL-68985-master
    • Hide

      Setup

      1. Login as admin.
      2. Access to "Site administration / Language / Language packs
      3. Install "Español - México (es_mx)" language pack.
      4. Go to the Content bank.
      5. Click on 'Upload' button.
      6. Upload attached true-false-quiz.h5p file and 'Save changes'.

      Testing scenario 1: English (en)

      1. Go to the Content bank.
      2. View the "true-false-quiz.h5p" view.
      3. Edit it.
      4. Check the editor is displayed without errors.
      5. Check all the strings are displayed in English.
      6. Open the "Text overrides and translations" section (at the end of the form).
      7. Select "Spanish, Mexican" from the Language list and Confirm the action.
      8. Check the content displayed below this Language drop-down is now displayed in Spanish-Mexican.

       

      Testing scenario 2: Español - México (es_mx)

      1. Go to the Dashboard.
      2. Select "Español - México (es_mx)" as the default language (using the dropdown in the header, next to the Moodle site name).
      3. Go to the Content bank.
      4. View the "true-false-quiz.h5p" view.
      5. Edit it.
      6. Check the editor is displayed without errors.
      7. Check some of the strings, such as the "title" are displayed in Spanish (Título).
      8. Open the "Text overrides and translations" section (at the end of the form).
      9. Select "English" from the Language list and Confirm the action.
      10. Check the content displayed below this Language drop-down is now displayed in English.

       

      Show
      Setup Login as admin. Access to "Site administration / Language / Language packs Install "Español - México (es_mx)" language pack. Go to the Content bank. Click on 'Upload' button. Upload attached true-false-quiz.h5p file and 'Save changes'. Testing scenario 1: English (en) Go to the Content bank. View the "true-false-quiz.h5p" view. Edit it. Check the editor is displayed without errors. Check all the strings are displayed in English. Open the "Text overrides and translations" section (at the end of the form). Select "Spanish, Mexican" from the Language list and Confirm the action. Check the content displayed below this Language drop-down is now displayed in Spanish-Mexican.   Testing scenario 2: Español - México (es_mx) Go to the Dashboard. Select "Español - México (es_mx)" as the default language (using the dropdown in the header, next to the Moodle site name). Go to the Content bank. View the "true-false-quiz.h5p" view. Edit it. Check the editor is displayed without errors. Check some of the strings, such as the "title" are displayed in Spanish (Título). Open the "Text overrides and translations" section (at the end of the form). Select "English" from the Language list and Confirm the action. Check the content displayed below this Language drop-down is now displayed in English.  
    • Moppies Kanban

      If you are using a language that has an underscore in it, such as en_us, go to the content bank, select Add > anything, you will get a fatal error:

      Coding error detected, it must be fixed by a programmer: Cache definition core/string requires simple keys. Invalid key provided.
       
      More information about this error
       
      Debug info: en-us_h5plib_v124_1591674567
      Error code: codingerror
       
      line 617 of /cache/classes/helper.php: coding_exception thrown
      line 958 of /cache/classes/loaders.php: call to cache_helper::hash_key()
      line 392 of /cache/classes/loaders.php: call to cache->parse_key()
      line 1553 of /cache/classes/loaders.php: call to cache->get()
      line 124 of /lib/classes/string_manager_standard.php: call to cache_application->get()
      line 327 of /lib/classes/string_manager_standard.php: call to core_string_manager_standard->load_component_strings()
      line 10509 of /lib/moodlelib.php: call to core_string_manager_standard->get_string()
      line 10534 of /lib/moodlelib.php: call to lang_string->get_string()
      line 10532 of /lib/moodlelib.php: call to lang_string->out()
      line 143 of /h5p/classes/local/library/handler.php: call to lang_string->out()
      line 8072 of /lib/moodlelib.php: call to core_h5p\local\library\handler::get_h5p_string()
      line 160 of /h5p/classes/local/library/autoloader.php: call to component_class_callback()
      line 454 of /h5p/classes/editor.php: call to core_h5p\local\library\autoloader::get_h5p_string()
      line 383 of /h5p/classes/editor.php: call to core_h5p\editor->get_editor_translations()
      line 194 of /h5p/classes/editor.php: call to core_h5p\editor->add_assets_to_page()
      line 116 of /contentbank/contenttype/h5p/classes/form/editor.php: call to core_h5p\editor->add_editor_to_form()
      line 214 of /lib/formslib.php: call to contenttype_h5p\form\editor->definition()
      line 59 of /contentbank/classes/form/edit_content.php: call to moodleform->__construct()
      line 94 of /contentbank/edit.php: call to core_contentbank\form\edit_content->__construct()
      

      Now, for some reason in the key, en_us is getting converted to en-us. But the cache core/string is defined as using simple keys, which only allows alphanum and _. No hyphens allowed.

            sarjona Sara Arjona (@sarjona)
            emerrill Eric Merrill
            Carlos Escobedo Carlos Escobedo
            Adrian Greeve Adrian Greeve
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 35 minutes
                3h 35m

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