Fix untranslated error messages in add.html
and web.html
.
#8848
Labels
Lead: @jimchamp
Issues overseen by Jim (Front-end Lead, BookNotes) [managed]
Priority: 3
Issues that we can consider at our leisure. [managed]
Type: Bug
Something isn't working. [managed]
Problem
While working on another issue, I noticed that a few strings in the cover and link adding forms are not getting translated because they are written in the JavaScript rather than the HTML files, so get ignored for internationalization: i.e.
$('#link-errors').html('Please provide a label.');
inedit.js
Evidence / Screenshot
Reproducing the bug
Note: You can follow the same process with trying to submit a new cover image without entering a link or an image file.
Context
Proposal & constraints
Very simple! The clearest way to fix the problem would be to replicate the approach @cdrini suggested for #8754 - transfer the relevant error messages into the HTML as a data attribute, and then access the data attribute in the JavaScript as needed.
This can also be bundled with a quick fix to make the "URL" and "Add Link" text correctly formatted for internationalization directly in the HTML.
Related files
openlibrary/plugins/openlibrary/js/edit.js
openlibrary/templates/books/edit/web.html
openlibrary/plugins/openlibrary/js/covers.js
openlibrary/templates/books/add.html
Stakeholders
The text was updated successfully, but these errors were encountered: