Adding and translating to french "default" strings for all H5P libraries

Hi !

I've noticed that in the PHP libraries the semantics.json files contain "default" values for some texts : for instance "Retry", "Show solution", "Your result", etc. These default strings are not to be found in the french translations (fr.json). It means that each time that a french user creates a new H5P content, he has to translate all the english default texts to french. In the case of the question set, if we use 3 different types of contents (drag and drop, multichoice, fill in the blanks for instance... ), then translating all the default texts takes a really long time and makes creating content very painful...

That's why I'd like to help by to adding and translating the "default" english strings to french for all the H5P libraries.

But how should I proceed ? Should I edit fr.json directly of Github ? I would not want to mess the files...

Thanks for pointing out the right way to do that !

Greetings,

Isabella 

falcon's picture

Hi Isabell

If you're familiar with github the best way is actually for you to edit them on github. The repository maintainers will then receive pull requests and make sure everything works before your changes goes into the official repositories.

You'll have to add something like;

"default": "recommencez"

where these are missing with a comma after the current last line in the json block. Let me know if you need some more info here as I do not now if you know how to handle json.

 

Hi Falcon,

I'm not familiar at all with Github but I've signed up. In fact, I know how to handle and edit the json file (my husband showed me how to). What I don't know is how I should proceed on Github... So here is what I've done so far :

  1. I have forked the latest version of "H5P.questionset" from H5P Github repository and edited the fr.json file by adding one "default" string (one that I've tested directly in my SQL database yesterday to check if it was ok).
  2. Then I've clicked on "Commit directly to the master branch" to save this change. But maybe I should have clicked on "Create a new branch for this commit and start a pull request." ? I've read the help files on Github but this is a bit confusing for newbies... I really don't want to mess your files / work. 

Thanks for your help !

Greetings,

Isabelle

 

falcon's picture

Hi Isabelle, I'm sorry for the late reply. We're getting so many requests at the moment.

I think the easiest way is to (1) go to the file you want to change on github, for instance:

https://github.com/h5p/h5p-multi-choice/blob/master/language/fr.json

2. Click the pen button (edit this file)
3. Make your changes following your husbands guidelines. It is not user friendly at all, border line programming, but the coder who merges in the changes will hopefully be able to spot any unwanted changes in the the json structure.
4. Choose "Create a new branch for this commit and start a pull request." and click "propose file change".

Let me know if this doesn't work out for you :)

Hi Falcon !

I've done a french translation for the Question-Set type of content on Github and pulled a request. Hope I did well... Let me know please before I go on ;)

Greetings,

Isabelle

falcon's picture

Seems you did very well :)

papi Jo's picture

The reason for this problem is to be found in the h5p-cli library in the h5p.js file function removeUntranslatables(field, name) line 797.

name !== 'default' should be added to the condition in order to retain the potential 'default' fields in the semantics.json files to be translated.

 

papi Jo's picture

Actually, some "default" fields are translatable and others are not (numbers, booleans, text representations of HTML color tags, etc). This makes it really difficult to automatically include or exclude them in the language files for translation!

Maybe a new field category should be made available to the H5P semantics.json file, called something like "defaultTxt" or "defaultStr", and filtered accordingly in the h5p.js file function removeUntranslatables(field, name) function.

tim's picture

Good catch. A pull request by Otacke has recently been merged:

https://github.com/h5p/h5p-cli/pull/14/files

Does this solve the problem?

papi Jo's picture

Just tested the new h5p.js script with the added removeUntranslatables function. Works fine for most of the cases. The only cases which are not caught are color defaults, because those are of "text" type in semantics. Examples:

"label": "Border color for drop zones",
              "description": "If this color is set, it will override the color of the individual dropzones borders",
              "default": "rgba(255, 255, 255, 0)",
              "spectrum": {}

Note that the "spectrum" field should be removed too.

As I said on another thread, it might be useful if the h5p.js script added englishLabel, englishDescription, etc. lines to the language output file, to help translators.

Finally, the current translation process of the h5p semantics files is not really user-friendly and prone to errors. If a translator accidentally overwrites, deletes or change in any way the code outside of the actual string to be translated, then the H5P content/activity editor will crash!

 

tim's picture

Yes, the translation 'system' is both unclear and oftentimes dangerous!

I've been thinking about the best way to solve this. On one hand we have the 'magic bullet' of a Transifex integration, which may not happen until the Core Team has a bit more time. 

On the other hand, we can continue doing small fixes such as adding englishLabel, englishDescription etc

The benefit of the slow and steady approach is that the community gets the improvements straightaway but the disadvantage is that they may be rendered obselete if/when the Transifex integration happens. 

I would like to know your thoughts on this. 

otacke's picture

I think it wouldn't hurt to make minor changes to h5p-cli if there's some spare time. Who knows when the magic bullet might finally reach its target ...

tim's picture

Agreed.