Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate api should support 'format' request parameter #1573

Closed
WarTech9 opened this issue Sep 6, 2016 · 2 comments
Closed

Translate api should support 'format' request parameter #1573

WarTech9 opened this issue Sep 6, 2016 · 2 comments
Assignees
Labels
api: translate Issues related to the Cloud Translation API.

Comments

@WarTech9
Copy link

WarTech9 commented Sep 6, 2016

I am using the Translate module the Google cloud package.
Google translate API allows the user to specify the format for translation as a query parameter (text, or html, defaults to html) https://cloud.google.com/translate/v2/translate-reference

Defaulting to HTML format translations means the translation results contain HTML entities, which is not desired in most cases when using the API, because results are not displayed directly on a web page. This package should allow sending the format as a parameter, probably as part of the options parameter to the translate function.

Environment details

  • OS: Any
  • Node.js version: 6.5.1
  • npm version: 3.8.9
  • google-cloud-node version: 0.39.0

Steps to reproduce

var googleCloud = require('google-cloud');
var gtranslate = googleCloud.translate;

var translator = gtranslate({
  key: API_KEY,
});

translator.translate('How are you today?', {source: 'en', target: 'fr', format: 'text'}, (err, result) => {
    console.log(result);
});

Expected results: Comment allez-vous aujourd'hui?
Actual results: Comment allez-vous aujourd'hui?

Thanks!

@stephenplusplus
Copy link
Contributor

Whoops, I didn't realize we were doing that! We will definitely open up that option. Any interest in sending a PR? We've got a big backlog, so any help is greatly appreciated :)

@stephenplusplus
Copy link
Contributor

Fixed in #1647. Thanks again, @innovative1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: translate Issues related to the Cloud Translation API.
Projects
None yet
Development

No branches or pull requests

2 participants