Change the suggested default values for Settings and texts
Submitted by mariaso on Wed, 08/10/2016 - 12:53
Forums:
Hi.
is it possible to change the suggested default values for Settings and texts? I would like for example the text "Check" by default to be "Kontrollera", so that I don't have to change the text every time I make a new H5P content. I thought that maybe I can change in a file on the server hosting my WordPress site, but I didn't find it. Or that it could possible be in the database, but I didn't find it there either. Any help?
otacke
Wed, 08/10/2016 - 22:27
Permalink
There are locale files
There are separate locale files that can be used to translate the messages of h5p's libraries.
On a Wordpress system, you should be able to find the libraries' folders in /wp-content/uploads/h5p/libraries if I am not mistaken.
For more information about translating the locale files (or semantics), you might want to visit https://h5p.org/documentation/for-developers/translate-h5p-libraries
mariaso
Thu, 08/11/2016 - 07:55
Permalink
Which file in libraries is it?
I went to /wp-content/uploads/h5p/libraries to look, but there were a lot of folders and none of theme had a title "Settings and text" or something similar so I have no idea which file to change. Does someone know?
I also tried to create a translation file but I got an error: "no such file or directory". And when I tried "get h5p-summary" I got a lot of "Failed". If I would have more time I could spend time trying to solve this and even try to make a translation for Swedish, but I do not have time (I might be able to do this later in the autumn). I have already spent to much on trying to figure this one out. Could someone help me please?
otacke
Thu, 08/11/2016 - 08:13
Permalink
There is not one file, but many
There is not one file, but many.
What you see in the folder I pointed you to are the libraries of h5p. There is e.g. h5p-multi-choice for multiple choice questions. Every component of h5p that can be translated has a folder called language that contains files like it.json (for Italian) or fr.json (for French). You might want to take one of these, copy them to se.json and translate the contents.
mariaso
Thu, 08/11/2016 - 12:43
Permalink
Confused
I found the files you refer to, however how do I find the english version? Translating from italian or french is not really working...
otacke
Thu, 08/11/2016 - 12:57
Permalink
There is no such file for
There is no such file for English. English phrases are embedded in semantics.json in the main folder of a library (see https://h5p.org/documentation/for-developers/translate-h5p-libraries). This file has nearly the same structure as those files in the language folder, but it contains more information that is not necessary for language files. You can create a fresh language file using H5PCLI as described on the page that I linked to above.
mariaso
Thu, 08/11/2016 - 13:30
Permalink
Thank you!
I will see if it will go better this time then. Thank you for all help!!
falcon
Thu, 08/11/2016 - 10:19
Permalink
Here is a relevant guide
Here is a relevant guide under translation
mariaso
Thu, 08/11/2016 - 12:36
Permalink
Helpful, but not helping
Thank you for that, I can probably translate to Swedish the texts that was in the h5p-nb_NO.pot file later on in the autumn. However the file did not include the texts that I want to change. I didn't find the "Check" or "Retry" texts there. I'll add screenshot where I have highlighted the areas I want to change.
otacke
Thu, 08/11/2016 - 12:59
Permalink
You can use this guide if you
You can use this guide if you want to translate the Wordpress plugin, but not the h5p libraries.
mariaso
Thu, 08/11/2016 - 13:29
Permalink
Ok!
I see, thank you for the information!
otacke
Thu, 08/11/2016 - 13:32
Permalink
You're welcome! Don't
You're welcome! Don't hesitate to ask again.
mariaso
Thu, 08/11/2016 - 13:46
Permalink
Next question...
I don't understand the following instructions, at all. Any help in explaining?
Enclose the content in a semantics object
The H5P Editor looks for a "semantics" object in the language file, which must match the structure of your semantics.json file. This step is completed by simply adding an outer object with a field called semantics. This fields should contain the modified semantics.json file from last step.
otacke
Thu, 08/11/2016 - 16:08
Permalink
Tech talk ;-)When you have
Tech talk ;-)
When you have use semantics.json as a basis for a translation, it will look something like this...
<code>
[
{
LOTS OF LINES HERE
}
]
</code>
To make it a proper language file like se.json, you must change the start end the end of the file a little bit. Add { "semantics" : at the start and } at the end without the quotation marks. The file should then look like:
<code>
{
"semantics": [
{
LOTS OF LINES HERE
}
]
}
</code>
Proper formatting would require indenting the inner part, but don't worry about that right now.
mariaso
Fri, 08/12/2016 - 07:33
Permalink
Interesting!
Ahaa, thank you! Since I have done a little bit of HTML and Java several years ago I do understand indenting :)
How do the semantics.json file know to search for the language file?
I looked in both the nn.json file and the sematics.json file when I started to translate, because I wasn't really sure about which lines was ok to remove. For example "options":[ "H5P.Image 1.0","H5P.Video 1.2" ], is that ok to remove? However the nn.json file did not seem to have the label "Type" at all so I became a bit confused. This was from the MultiChoice folder.
Thank you so much for the help, I hope that I can contribute with translating despite my little knowledge in this.
falcon
Fri, 08/12/2016 - 10:30
Permalink
That is a bit hard to answer,
That is a bit hard to answer, but every object in the semantics has to be kept. An object is enclosed in {}. Technical properties inside the objects like "library" and "optional" does not have to stay. The best thing to do is to use one of the existing languges as a template. There is also a command for the H5P CLI that can generate a template file for you.