How to use linguist - 1 common examples

To help you get started, we’ve selected a few linguist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ava-ia / core / ava / translators / translator.yandex.js View on Github external
return new Promise((resolve, reject) => {
    if (state.language.iso === LANGUAGE) return resolve(state);

    const time = new Date();
    Linguist.translate(state.rawSentence, state.language.iso || LANGUAGE, LANGUAGE, (response) => {
      state.language = {
        engine: 'yandex',
        ms: (new Date() - time),
        iso: response.lang,
      };
      state.sentence = response.text[0];
      resolve(state);
    });
  })
}

linguist

Translate strings or whole JSON files

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular linguist functions