WIP: Make sure to throw an error when no translation is found #281
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.
What does this PR solve?
It propagates the translation error when a translation isn't found for a given key (or if the language doesn't exist).
My colleague and I ran into this issue today while running pa11y where a missing translation resulted in an
Uncaught TypeError: Cannot read property 'replace' of undefined
from this package. I think this should take care of it, so we would get the right error propagated instead :)My colleague created a minimal-reproduction-repo where you can see the error. If you use
npm link
to link HTML_CodeSniffer to this branch instead you can see the actual translation error getting propagated.The weird thing though is that the specific key (
1_3_5_H98.InvalidAutoComplete_Text
) it complained about isn't missing in the translation file (en.js
). I haven't had the time to look into that bit, but this get us halfway there :)