linguacode-translator is a library which allows to translate text to code and the opposite.
yarn add https://github.com/linguacode/linguacode-translator --save
npm install https://github.com/linguacode/linguacode-translator --save
var translator = require('linguacode-translator');
var text = 'տպել("բարեւ")';
var textToCode = translator.toCode(text, 'hy'); //@output("բարեւ")
var textToCodeToText = translator.toText(textToCode, 'hy'); //'տպել("բարեւ")'
console.log(text == textToCodeToText) //true
var translation = translator.translate(textToCode, 'hy', 'ru'); //'вывести("բարեւ")'
translator is licensed under MIT.