i18next-parser
i18next-parser copied to clipboard
Allow to disable parsing/warning for single line
🚀 Feature Proposal
It would be nice, if one could disable a single line from beeing parsed. I could quite well imagine to have special comments for this like e.g. eslint does: /* i18next-parser-disable-next-line */ or // i18next-parser-disable-line
Motivation
Having custom methods, that put text (i.e. keys) into an array (must be parsed), while some text must be put into the same array but NOT beeing parsed, i would need to disable single lines from beeing parsed.
Further, having the t() function then inserting the respective text out of the array into the page as translated text, i have the t-function onto an array-elements, which gives me a warning. For not to have to check each single warning each time (could even be some new ones and i don't want to miss them...?!) it would be cool to disable the parsing/warning on this line after checking once, so i don't have to check it each time again.
Example
OneFile.js
addToArray('This should be translated, but i will store it and use the actual translation later.');
// Next line should not be parsed, as the error will be in english anyways.
addToArray('Fatal Error: {{ error }}', { error });
SecondFile.js
$arrayFromOneFile.forEach( (element) => {
// Next line should not be parsed, as i know it will give a warning, but i checked it and the code is right.
insertIntoPage( i18n.t(element) );
}
I'm fine with the proposal and I will happily review a PR!