I am using Poedit's "Update from code" function to extract strings from my javascript code. The issue is that I use ES6 template strings in my code, like so:
const myVariable = 5;
const myString = `My variable value is: ${variable}`
This causes the following error to appear when I extract the string for translation:
warning: RegExp literal terminated too early
Some research told me that this is due to a bug with gettext.
Is there a way for me to still use Poedit with template strings or should I give up on the software?
Figured it out. It turns out that the error was not caused by the template literals, but by the usage of JSX.
The app is a React app and writing something like
function MyComponent() {
return <Comp></Comp>
}
Will trigger the warning, while this won't:
function MyComponent() {
return (<Comp></Comp>)
}
In general, using JSX anywhere in my code without surrounding it with parenthesis seems to cause the issue.