i18next-scanner
i18next-scanner copied to clipboard
Unable to parse classes with decorators
Version
- i18next: 11.10.2
- i18next-scanner: 2.10.3
Configuration
{
sort: true,
removeUnusedKeys: true,
defaultValue: '__NEEDS_TRANSLATION__',
lngs: ["en", "es", "fr", "pt"],
attr: {
list: ['i18n', 't']
},
func: {
list: ['this.i18n.tr', 'i18n.tr']
},
ns: ["translation", "settings"],
defaultNs: "translation",
resource: {
loadPath: '../../locales/{{lng}}/{{ns}}.json',
savePath: '{{lng}}/toTranslate_{{ns}}.json'
}
}
I have a simple aurelia application (framework doesn't matter) that uses a decorator on a class to do dependency injection.
...
@inject(I18N)
class App {
constructor(i18n) {
this.i18n = i18n;
}
}
When this file is scanned, I get an error (the '@' symbol on line 20 is the decorator):
i18next-scanner: Unable to parse Trans component from "E:\\WebApplication\\src\\app.js"
SyntaxError: Unexpected character '@' (20:0)
This used to work just fine back in version 2.9.2, but since 2.10.0 every version has this kind of problem. I am expecting the scanner to still be able to scan these files.
Hello, I also encountered the same problem, do you have a solution?
Nope, I've had to revert back to a previous version to get this to work. Just locked it to that specific version.
Hi, I've just tried to do this and have the same problem, also installed 2.9,2 instead of 4.0.0 and still have problem with decorators. I used to do this as well.
Is there a way to get acorn to use an es7 plugin so that it parses @ or a way to skip them through some added function? I'd love to be able to use this.
Hi, I've just tried to do this and have the same problem, also installed 2.9,2 instead of 4.0.0 and still have problem with decorators. I used to do this as well.
Is there a way to get acorn to use an es7 plugin so that it parses @ or a way to skip them through some added function? I'd love to be able to use this.
I have the same problem. Asking chatgpt3.5 for help also failed to solve the problem. Thank you very much.
Any ideas how to solve this?