Skip to content

can you specify a source language for the google translate API? #484

Closed

Description

@talkingtab

I would like to be able to specify a source language. I know I can autodetect, but is there a way to specify exactly the language "i" is and in Czech and so if I want to translate to French, how would I do that?

Activity

  1. jmdobry commented on Sep 20, 2017

    @jmdobry
    Member
    // Imports the Google Cloud client library
    const Translate = require('@google-cloud/translate');
    
    // Instantiates a client
    const translate = Translate();
    
    // The text to translate
    const text = 'Ahoj světe!';
    
    // The source language
    const source = 'cs';
    
    // The target language
    const target = 'fr';
    
    const options = {
      from: source,
      to: target
    };
    
    translate.translate(text, options)
      .then((results) => {
        console.log(JSON.stringify(results, null, 2));
      })
      .catch((err) => {
        console.error('ERROR:', err);
      });
  2. added a commit that references this issue on Oct 26, 2022
  3. added a commit that references this issue on Nov 3, 2022
  4. added a commit that references this issue on Nov 11, 2022
  5. added a commit that references this issue on Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.triage meI really want to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions