use google translate on H5P contents
I use H5P on a WP multisite install and it runs fine.
On this install, I also have a WP plugin from GTranslate (https://fr.gtranslate.io/), which is a really nice solution to have my content multilingual.
The GTranslate plugin uses Google Translate and runs fine on standard WP content.
You can check it here by selecting a new language from the widget displayed in the lower left corner of the page.
Unfortunately, the GTranslate plugin does not work on H5P content.
You can check it here:
When you select a new language, only the title is translated, which is standard WP content, but not H5P contents.
I have noticed the H5P contents are generated within iframes, and this may be the reason why they are not translated, as Google Translate does not automatically translate content in iframes.
So I think the issue is not plugin related, it is more a compatibility issue between Google Translate and iframes, in this cas H5P iframes.
Can you please provide a workaround for this?
Thu, 09/06/2018 - 10:01
You're correct. H5P being embedded in iframes is the reason why the contents are not translated -- and for security reasons, it's a very good idea that scripts cannot change the contents of iframes (unless everything resides on your own server). I don't think there's a simple workaround for this issue.
Thu, 09/06/2018 - 17:28
Hi Otacke,We use our own WP
JQuery could be used to trigger a translation of the HTML div generated by H5P when the user selects a new language.
At what time is generated the HTML for H5P Activities? On the server? Using AJAX requests sent from the browser (doesn't seem so)?
Have you standardized ids or classes for iframes generated by H5P, so we could use those to identify them?
Fri, 09/07/2018 - 09:23
Hi Eric!The special server
Fri, 09/07/2018 - 09:53
Hi Otacke, I will investigate
Hi Otacke, I will investigate this and keep you informed of the outcome.
Mon, 05/20/2019 - 15:53
working solution but needs some enhancement
One year has passed and I come back with a solution developed by the people of the GTranslate plugin.
You can see a working example of localized H5P contents here: https://trials.knowledgeplaces.com/en/training/h5p-for-gtranslate/
There is a language selector at the bottom left of the page. The content is originally in French, but you can display it in Chinese, English and German.
This solution works perfectly but has one drawback: we have to modify some code in the H5P plugin, and this customized code would be lost each time we update the H5P plugin.
I would like to avoid this, and I have attached the following files:
class-h5p-plugin.txt: the updated version of ..\wp-content\plugins\h5p\public\class-h5p-plugin.php
class-h5p-gtranslate.txt: the PHP file included by the updated version of class-h5p-plugin.php
Please take some time to look at this, and tell me if there is an equivalent solution without impacting H5P core plugin files.
Thanks in advance.
Mon, 05/20/2019 - 22:33
Hi atriaforever!You should
You should address someone of the H5P core team. I can't do anything related to the H5P core.
Tue, 05/21/2019 - 09:08
Hi atriaforever and Oliver,I
Hi atriaforever and Oliver,
I already informed the core team regarding this.
Tue, 05/21/2019 - 09:36
Thanks BV52, do I follow up
Thanks BV52, do I follow up on this post or by another mean?
Wed, 05/22/2019 - 03:23
Hi atriaforever,I created a
I created a task in the public board so that the core team can review your code.
Fri, 09/13/2019 - 17:24
Any progress on this ?
Hello, any progress on this? H5P have been updated, and we have to manually apply our changes, so this is not convenient for us.
Mon, 09/16/2019 - 18:30
Hi atriaforever,I wish I have
I wish I have good news but so far there are no updates yet.