Corrected overcorrections which caused ampersands to be html-encoded #352
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.
Keys are broken by gettext if they contain ampersands that are not html-encoded. The reason is, gettext uses .html() on keys in a few places, which html-encodes ampersands (among other special characters).
The two places in gettext that break keys with amersands are in directive.js line #99 and in catalog.js line #174.
I've corrected this by comparing the original key to the "overcorrected" key, and where the original did not have an html-encoded ampersand, the html-encoded ampersand is replaced with an unencoded ampersand.
A new function rollBackOvercorrections is used for this correction. Tested and working in a large project with 1500 translated translations.
This PR only fixes ampersands, but other html-encodings can also be fixed with a simple addition to this code.