-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(ajax responses): Improved localization handling, error reporting…
… and success messages (#363) * feat(ajax responses): added IAjaxResponse interface * refactor(error reporting): Nearly all errors now use ids instead of literals * refactor: removed unnecessary dependencies of classes * feat: Removed all error literals from the code and refactored all error handling * fix(tests): Corrected signature of H5pEditor instanciation * refactor(error handling): Converted error handling to Express pattern * refactor(translation): added i18next and removed obsolete ITranslationService * refactor(ajax endpoints): Responses now use interface return errors properly * refactor(ajax endpoints): Added success message when installing and updating libraries * refactor(translations): reorganized translation directory structure * refactor(error reporting): added i18next to example * fix: Corrected url generator for library files and fixed reference to client language strings * feat: Updated English client language strings and fixed errors * refactor: minor wording improvements * refactor(ajax endpoint): Ajax endpoint now emits library installation und update message * feat(tests): Added first tests for Express adapter. BREAKING CHANGE: ILibraryStorage.getFileStream is now async! * test: Added more AJAX endpoint tests * test(express adapter): Added test for content type endpoint * tests(AJAX endpoint): Added more tests for AJAX endpoint * tests(ajax endpoint): Added test for getting library data and fixed related issues where current implementation doesn't conform to the H5P standard * tests(ajax endpoints): Added tests for getting translations and validation errors when uploading packages * refactor: Cleanup and added documentation * docs: Added error handling to documentation * feat(error reporting): Errors reported to the client now follow the H5P standard * fix(error reporting): Corrected replacements * refactor(example): Removed ineffective string interpolation * docs: Corrected typos
- Loading branch information
Showing
63 changed files
with
1,806 additions
and
1,204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"missing-h5p-extension": "The file you uploaded is not a valid HTML5 Package (It does not have the .h5p file extension)", | ||
"unable-to-unzip": "The file you uploaded is not a valid HTML5 Package (We are unable to unzip it)", | ||
"file-size-too-large": "One of the files inside the package exceeds the maximum file size allowed. ({{file}} {{used}} > {{max}})", | ||
"total-size-too-large": "The total size of the unpacked files exceeds the maximum size allowed. ({{used}} > {{max}})", | ||
"invalid-content-folder": "A valid content folder is missing", | ||
"invalid-h5p-json-file": "A valid main h5p.json file is missing", | ||
"not-in-whitelist": "File "{{filename}}" not allowed. Only files with the following extensions are allowed: {{files-allowed}}.", | ||
"unable-to-read-package-file": "Unable to read file from the package: {{fileName}}", | ||
"unable-to-parse-package": "Unable to parse JSON file from the package: {{fileName}}", | ||
"invalid-h5p-json-file-2": "The main h5p.json does not conform to the schema ({{reason}})", | ||
"api-version-unsupported": "The system was unable to install the {{component}} component from the package, it requires a newer version of the H5P plugin. This site is currently running version {{current}}, whereas the required version is {{required}} or higher. You should consider upgrading and then try again.", | ||
"invalid-library-name": "Invalid library name: {{name}}", | ||
"invalid-library-json-file": "Could not find library.json file with valid json format for library {{name}}", | ||
"invalid-schema-library-json-file": "The library.json file of the library {{name}} is invalid ({{reason}})", | ||
"library-missing-file": "The file "{{file}}" is missing from library: "{{name}}"", | ||
"invalid-semantics-json-file": "Invalid semantics.json file has been included in the library {{name}}", | ||
"invalid-language-file": "Invalid language file {{file}} in library '{{library}}'", | ||
"invalid-language-file-json": "The JSON of the language file {{file}} in the library {{library}} cannot be parsed", | ||
"library-directory-name-mismatch": "Library directory name must match machineName or machineName-majorVersion.minorVersion (from library.json). (Directory: {{directoryName}} , machineName: {{machineName}}, majorVersion: {{majorVersion}}, minorVersion: {{minorVersion}})", | ||
"error-creating-temporary-directory": "Could not create temporary directory to unpack H5P package", | ||
"corrupt-file": "The file {{file}} could not be read from the H5P package. The package seems to be corrupt.", | ||
"hub-install-no-content-type": "No content type was specified.", | ||
"hub-install-invalid-content-type": "The chosen content type is invalid.", | ||
"hub-install-denied": "You do not have permission to install content types. Contact the administrator of your site.", | ||
"hub-install-download-failed": "Could not download package from the Hub to temporary file.", | ||
"upload-package-failed-tmp": "Could not save uploaded package to temporary file.", | ||
"content-file-missing": "File {{filename}} does not exist in {{contentId}}", | ||
"error-generating-unique-content-filename": "Cannot determine a unique filename for {{filename}}", | ||
"error-communicating-with-hub": "Could not fetch content type information from the H5P Hub. HTTP status {{statusCode}} ({{statusText}})", | ||
"error-communicating-with-hub-no-status": "Could not fetch content type information from the H5P Hub.", | ||
"error-registering-at-hub": "Could not register this site at the H5P Hub. HTTP status {{statusCode}} ({{statusText}})", | ||
"error-registering-at-hub-no-status": "Could not register this site at the H5P Hub.", | ||
"library-not-found": "Library {{name}} was not found.", | ||
"invalid-main-library-name": "mainLibraryName is invalid: {{message}}", | ||
"library-consistency-check-not-installed": "Can't check library consistency for {{name}} as the library is not installed.", | ||
"library-consistency-check-library-json-unreadable": "Error in library {{name}}: library.json not readable: {{message}}", | ||
"library-consistency-check-file-missing": "Missing files in library {{name}}: {{files}}", | ||
"invalid-ubername-pattern": "'{{name}}' is not a valid H5P library name (\"ubername\"). You must follow this pattern: {{example}}'", | ||
"download-content-not-found": "Content can't be downloaded as no content with id {{contentId}} exists.", | ||
"download-content-forbidden": "You do not have permission to download content with id {{contentId}}.", | ||
"download-content-unreadable-data": "Content can't be downloaded as the content data is unreadable.", | ||
"download-content-unreadable-metadata": "Content can't be downloaded as the content metadata is unreadable.", | ||
"import-package-no-id-assigned": "Something went wrong when storing the package: no content id was assigned.", | ||
"installed-libraries": "Added {{count}} new H5P library", | ||
"installed-libraries_plural": "Added {{count}} new H5P libraries.", | ||
"updated-libraries": "Updated {{count}} old library.", | ||
"updated-libraries_plural": "Updated {{count}} old libraries.", | ||
"library-file-missing": "The requested library file {{filename}} of library {{library}} does not exist.", | ||
"malformed-request": "The request sent by the client is malformed: {{error}}", | ||
"package-validation-failed": "Validating h5p package failed." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"error-generating-unique-temporary-filename": "Cannot determine a unique filename for {{name}}", | ||
"temporary-file-not-found": "The file {{filename}} is not accessible for user {{userId}} or does not exist.", | ||
"add-file-content-not-found": "Cannot add file {{filename}} to content with id {{id}}: Content with does not exist.", | ||
"error-creating-content": "Could not create content.", | ||
"error-generating-content-id": "Could not generate id for new content.", | ||
"delete-content-not-found": "Cannot delete content: It does not exist.", | ||
"delete-content-file-not-found": "Cannot delete file {{filename}}: It does not exist.", | ||
"add-library-file-not-installed": "Can't add {{filename}} to library {{libraryName}} because the library metadata has not been installed.", | ||
"clear-library-not-found": "Can't clear library {{libraryName}} because the library has not been installed.", | ||
"install-library-already-installed": "Library {{libraryName}} has already been installed.", | ||
"remove-library-library-missing": "Library {{libraryName}} is not installed on the system.", | ||
"update-library-library-missing": "Library {{libraryName}} can't be updated as it hasn't been installed yet.", | ||
"illegal-relative-filename": "Relative paths in filenames are not allowed: {{filename}} is illegal", | ||
"illegal-absolute-filename": "Absolute paths in filenames are not allowed: {{filename}} is illegal" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.