Add localization for mhchem error messages.#1477
Open
dpvc wants to merge 3 commits into
Open
Conversation
3b5073d to
a88ad80
Compare
zorkow
requested changes
May 19, 2026
Member
zorkow
left a comment
There was a problem hiding this comment.
I believe you are registering the wrong locale folder.
Co-authored-by: Volker Sorge <v.sorge@mathjax.org>
Member
Author
Thanks for catching that. Copy-and-paste error. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds localization for the
mhchempackage, for both English and German. It uses the error id and message thrown by the mhchem parser and translates them into the format needed for the new localizedTeXErrorobject. Some of the messages have data inserted into the message strings that has to be extracted to be used as a parameter toTexError, and one of the messages is re-using the[tex]/basemessageExtra close brace or missing open brace.I've updated the test file for mhchem, but have not been able to get full coverage. The bond error message actually can never be produced, but I've included it in case the mhchem parser ever changes to permit it. I wasn't able to generate one of the two-parameter bug messages (they seem to be for actual bug conditions, so may not be producible). So the coverage for mhchem is not as complete as it was.
Note that if you add
to the
lib/v4-lab.jsfile in the MathJax configuration'sloaderblock (just afterrequire: ...for example), then this will cause the json files to be loaded directly from thets/input/tex/<package>/__locales__directory, so you won't have to keep doing the copy script. Also note thatwill perform the copying to
bundlefor a given component, whilewould copy all of them.