Add translate to content in Moodle


Hi everyone,

I would try to add a languages customizations for some content types in Moodle.

I see all translates is in database (table mdl_hvp_libraries_languages). I think this is not good aproach for performance issues. (Moodle is going to use cache always if is posible).

The problem is ... ¿how I can add new translations or customizate the translations? I dont need download new version from h5p hub with a translations package I need translate the strings via Moodle. (for all languages I have already installed).

Of course, the final user need to customizate the strings via Moodle.

I try:

1. Modify the semantic in a renderer "hvp_alter_semantics", such as:

case 'H5P.Video':
                $semantics[0]->label = get_string('h5p_video_videosource', 'local_editores');
                $semantics[1]->label = get_string('h5p_video_visuals', 'local_editores');


Works, but is slowly and hard to mantain.

2. Use array_replace to modify only the semantic that I need. Create a new semantic file for each library and in the renderer use it. For example;

array_replace($semantic, $mysemantic);

My semantic is a file with an array of the customized strings (with same structure as semantic):

  "semantics": [
      "label": get_string("my string", "my plugin),
      "description": "An optional image to display above the task."


But... can i upload a new translate file for a library  in Moodle? Of course i can insert the semantic in the database via query ...

Any other solution?





tim's picture

Hi Alberto, have you had a look at the guide for contributing to H5P:
There you'll be able to find specific instructions for Moodle.