JS-Translator icon indicating copy to clipboard operation
JS-Translator copied to clipboard

Js with variables

Open udaraakadikwatta opened this issue 3 years ago • 1 comments

How to scan js with variables? eg: translate("string" + test['status'] );

currently it gives a exception

udaraakadikwatta avatar Jun 30 '22 08:06 udaraakadikwatta

The scanner doesn't know the value of test['status'] so it cannot get the translation id. If you need to add dynamic values in your translations, use the second argument:

translate('string :status', {':status': test['status']});

or sprintf syntax:

translate('string %s', test['status']);

oscarotero avatar Jun 30 '22 09:06 oscarotero