Remove hard coded English from existing H5P type. How can we make new H5P?
Hi
In one of the H5P-types there is a hard-coded sentence of English feedback. Because it is disruptive to language teaching and does not contribute anything extra, we simply want to remove it from the H5P.
We found the js-file containing the phrase. What do we need to do now to create the custom H5P type that can be installed on our Moodle?
- We have already read on this forum about the special way of zipping.
- But we will also have to change the internal version number, we suspect. To prevent problems on our Moodle. Where/how should that be done?
Thank you for the information.
We are brand new to this side of H5P. Up till now we only created lots of exercices with existing H5P’s.
-- Extra information ---------------------------------
The hard-coded feedback is in “Find Multiple Hotspots” in the file image-multiple-hotspot-question.js
We would like to change
if (this.params.imageMultipleHotspotQuestion.hotspotSettings.hotspotName) { feedbackText = (this.params.imageMultipleHotspotQuestion.hotspotSettings.hotspotName ? hotspot.userSettings.feedbackText+' '+this.score+' of '+this.maxScore+' '+this.params.imageMultipleHotspotQuestion.hotspotSettings.hotspotName+'.' : hotspot.userSettings.feedbackText+' '+this.score+' of '+this.maxScore+'.');
to
if (this.params.imageMultipleHotspotQuestion.hotspotSettings.hotspotName) { feedbackText = (this.params.imageMultipleHotspotQuestion.hotspotSettings.hotspotName ? hotspot.userSettings.feedbackText+'.' : hotspot.userSettings.feedbackText+'.');
Students can see the score on the bar juist before the feedback. And that removes the hard coded word ‘ of ‘.
Thank you for the help!
-SNT
otacke
Thu, 05/02/2024 - 08:56
Permalink
You should never ever change
You should never ever change the version number of content types that you do not maintain yourself! You will not be able to install official updates that bear the same version number. Also, if the content leaves your platform and finds its way onto another, you are going to infect their system with the same problem. This is not theory, but caused quite some trouble for Column just recently.
You will find insight into this topic at https://peter.baumgartner.name/2021/04/12/h5p-library-installation/ But please start reading the comments first!
SNTBrugge
Thu, 05/02/2024 - 11:32
Permalink
Thank you Oliver for the very valuable info.
Thank you Oliver for the very valuable info. But can we still register the modified component in our Moodle? Because the version with the hardcoded "OF" is already on our Moodle.
otacke
Thu, 05/02/2024 - 14:27
Permalink
That's what I described in
That's what I described in the comments ;-)
However, I do not recommend this. You're patching a library that you do not maintain. Chances are slim in this case, but people may (unknowingly) download content from your site and thus spread your patched version - and then they're going to have a hardcoded version of whatever you put in there. This would merely be an annoyance, but this can cause serious trouble, see https://h5p.org/comment/51633.
The clean way would be to create a pull request to the original repository and to change the code to make that string translateable. That won't help, because nobody maintains it currently. But since H5P Group still serve the content type, I feel that they have some form of responsibilty. I do NOT expect from them to maintain all the content types that they may inherit from others who stopped working on them (like Image Sequencing, Find the Words, ...) But they probably should have a plan for these cases.
The alternative would be, of course, that someone takes over the mantle and adopts the maintenance of Find Multiple Hotspots. Don't know if that's something that you would consider doing ...
otacke
Thu, 05/02/2024 - 15:01
Permalink
Please find a short story
Please find a short story line about why patching H5P libraries yourself may not be a good idea.
SNTBrugge
Thu, 05/02/2024 - 16:03
Permalink
Hi OliverThe reason why our
Hi Oliver
The reason why our need arose to dig into the code ourselves, is indeed that no one maintains the FIND MULTIPLE HOTSPOTS anymore. The author apparently left his legacy 7 years ago.
We are a school. I don't think I know anyone here who has the time to take the maintenance of an H5P component.
As you can see in our first post, we wouldn't even plan to change much. Just shorten a feedbackstring to remove the error.
It's actually a shame that there is no way to solve this. Because this is such a small operation.
It would indeed be fantastic if someone could take care of the orphaned H5Ps. Because, if there is no solution for an error in a component, people will work on it themselves. That seems logical to me.
Would it be OK if we gave our component a completely different name? In our case, nothing needs to change in libraries. But a bit like PAPI JO has also made own H5Ps. Do we have to change a lot to create a “SNT HOTSPOTS”?
-SNT
otacke
Thu, 05/02/2024 - 16:46
Permalink
I fully understand.It would
I fully understand.
Well, what would the incentive for that person/group be? You'd inherit outdated and partially flawed code and are supposed to clean up and then respond to others' requests in your free time. Yeay. ;-)
You can create a clean fork by changing the machineName in `library.json` and replacing respective references in the code, yes. Existing contents will still use the old version though, and those would need to be migrated. This involves changes in the database + rebuilding export files. There's no out-of-the-box procedure.
I am not a big fan of releasing those small changes into the wild that don't justify a real new content type. It's up to the platform maintainer to decide what content type should be installed, of course. I as an author wouldn't like to have two (or even more) variants of essentially the same content type and not know which one to choose. This may not feel like an issue for you, you could migrate content, remove the original version, use your's and not install another. But the idea of H5P content is to flow freely. If some of your users decides to share the content, uploading it to another platform will require to install your version, too - so you may indirectly cause confusion on other platforms.
SNTBrugge
Thu, 05/02/2024 - 16:56
Permalink
Thank you for the information
Hi Oliver
Not easy indeed.
But it's still a shame about those orphans. And there are already many of those orphan species.
Anyway, thank you for the insight.
-SNT
otacke
Thu, 05/02/2024 - 18:25
Permalink
Yes, I know. And that's why I
Yes, I know. And that's why I also mentioned that H5P Group should have a plan for these cases.