Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add translation strings to code #2

Open
nadavkav opened this issue Feb 19, 2018 · 7 comments
Open

Add translation strings to code #2

nadavkav opened this issue Feb 19, 2018 · 7 comments

Comments

@nadavkav
Copy link

Hello H5P Team,
Please see if you can add new translation tokens (and strings) the the following hardcoded text labels in the report code, as we wish to translate them.

see links:

$html = '<th class="h5p-matching-header-dropzone">Dropzone</th>' .
'<th class="h5p-matching-header-correct">Correct Answers</th>' .
'<th class="h5p-matching-header-user">Your answers</th>';

Best,
Nadav

@timothyylim
Copy link
Contributor

Hey @nadavkav :)

I've created an issue for it here:

https://h5ptechnology.atlassian.net/browse/HFP-1875

PR's are accepted too 👍

@nadavkav
Copy link
Author

nadavkav commented Feb 27, 2018

Hi @timothyylim ,
Since h5p-php-report is a non standard Moodle "sub plugin", I can not just add a "lang" folder and have get_string() use it. I suggest updating h5p-moodle-plugin with a new db/subplugins.php file that looks like:
$subplugins = array('editor'=>'mod/hvp/editor', 'library'=>'mod/hvp/library', 'reporting' => 'mod/hvp/report');
And after this PR is accepted into h5p-moodle-plugin... I can add a lang folder to this "sub plug" and fix the missing tokens and initial English translation strings.
Do this plan make sense to you?

@timothyylim
Copy link
Contributor

That makes sense to me, I've had the same problem with a new reporting template I've worked on recently. I kind of hacked it by passing the strings as html attributes:

https://github.com/h5p/h5p-php-report/blob/HFP-1841-Add-reporting-OEQ/type-processors/iv-open-ended-question-processor.class.php#L36

@thomasmars, is one who understands this 'sub plugin' the most. Let's wait for his opinion first :)

@nadavkav
Copy link
Author

Great :-)

@thomasmars
Copy link
Member

To me it feels like we should implement a similar translation system to what H5P core is using, thus making use of the get_string() functionality in Moodle and define the strings at the 'h5p' component level. E.g. reporting would have an interface for a translation function, then the H5P moodle plugin would implement the reporting module interface and thus also the translation function by using get_string(), or the H5P moodle plugin could pass in a dictionary to the reporting module containing all the strings that the reporting module needed.

The reporting module is a submodule that is used in other contexts than Moodle, so the translation system must be decoupled from Moodle and the subplugin system that Moodle has. However it could be wrapped in a Moodle submodule, but this would result in the H5P Moodle plugin having a Moodle reporting submodule, which then again would wrap the reporting module. The addition of the Moodle submodule layer seems unnecessary, but if there are compelling arguments for structuring it like this we should look closer at it.

@nadavkav
Copy link
Author

nadavkav commented Mar 5, 2018

Implement a similar translation system to what H5P core is using, thus making use of the get_string() functionality in Moodle and define the strings at the 'h5p' component level.

I agree, since this reporting module is shared with other non Moodle systems, it should be exposing an interface for translation, as other sub modules should.
Can you put it on the road map? open an issue for it on the jira?

@thomasmars
Copy link
Member

I've updated the issue Timothy created in the jira issue tracker. Thanks for the input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants