Comments (8)
I know that support for translatable content is a can of worms, but let's brainstorm it anyway!
from h5p-php-library.
All strings are part of the content json, and altering this backend is possible. Where would the translation come from? And how should it be matched against the strings in the content?
from h5p-php-library.
Braindump:
- An "Export" button in the H5P editor finds all the strings and serves them as a CSV file
- First row is the language code
- Values in the first columns work as translation keys
- Translator adds translations to the other columns of the CSV
- The file can now be imported back to the same H5P content
- End users can now see a "Change language" dropdown in the content
en | nb | fi |
---|---|---|
Apple | Eple | Omena |
Choose | Velge | Valitse |
(CSV used just as an example)
from h5p-php-library.
Would there be any way to generate translation keys automatically?
E.g. second option of a multiselect 1 on the page 2:
page2-multiselect1-option2
These could then be used to match a translation with a piece of content:
key | en | nb | fi |
---|---|---|---|
page1-multiselect1-option1 | Apple | Eple | Omena |
page1-multiselect1-option2 | Strawberry | Jordbærfarge | Mansikka |
from h5p-php-library.
The way translations are handled in H5P today is both a strength and a weakness. All texts displayed by an H5P is part of the content. Not only typically dynamically content like questions and answers, but also button labels and so on. The idea is that the H5P should look the same when e.g moved to another site.
Technically it would be possible to flatten the content.json hierarchy like you say, and make a unique key for each entry. Furthermore, functionality could be implemented where the translator gets something like the table you have sketched above.
There are a few possible problems with this approach, though. What happens e.g when the author reorders the questions in the quiz? One way of solving this would be to add some kind of unique ID to each leaf in the hierarchy. This ID should never change. Also, structural changes to semantics.json, which means content upgrade changes the content.json, has to be thought of. A unique ID would also solve this scenario.
from h5p-php-library.
What happens e.g when the author reorders the questions in the quiz?
Another braindump: Altering a piece of content (a page? a single element within a page?) would automatically cause invalidation of all the translations related to it. The author would then see a message:
Warning, translations are not in sync with the current structure.
Please export the translation file and add the missing translations.
The idea is that the H5P should look the same when e.g moved to another site.
The translations could be included into the .h5p
package just like any other data, right? Therefore the translations could be moved from site to another.
from h5p-php-library.
As you say, one solution is to invalidate the language file in certain scenarios.
And, It would be possible to include the language files in the H5P package.
from h5p-php-library.
Don't re-invent the i18n wheel. There are solid solutions for i18n in JavaScript: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Internationalization
from h5p-php-library.
Related Issues (20)
- Is $CFG->mod_hvp_crossorigin documented somewhere? HOT 4
- Separate PHP and JavaScript code HOT 5
- Add triggers for saveContentState/setUserData
- H5P.getUserData not used asynchronously where required HOT 1
- GDPR infringement HOT 1
- Error while playing content in v1.24.3
- When is next release scheduled? HOT 3
- "We will make available documentation and tutorials for creating platform integrations in the future." HOT 2
- H5PExport::createExportFile() performance issues
- Error Uncaught TypeError: Cannot read properties of undefined (reading 'field') HOT 1
- H5PCore in Tag 1.24.4 has a missing function libraryToFolderName HOT 1
- Support for MPEG-DASH format
- [BUG] Invalid argument supplied for foreach()
- Allow using HTML tags MARK and ABBR in H5P content types HOT 5
- [BUG] iframe embeds are not populated in the parent context.
- Class file structure and simplifying integration into a framework HOT 1
- Resizing problems of the container when calling mozRequestFullScreen() HOT 5
- add Moodle comp for 1.26 HOT 3
- Moodle-Plugin mod_hvp produced embed code not detected by h5p-resizer.js
- The `unload` event is deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h5p-php-library.