Skip to content

translate: api updates - #1781

Merged
stephenplusplus merged 5 commits into
googleapis:masterfrom
callmehiphop:translate-updates
Nov 14, 2016
Merged

stephenplusplus merged 5 commits into
googleapis:masterfrom
callmehiphop:translate-updates

Conversation

@callmehiphop

@callmehiphop callmehiphop commented Nov 9, 2016 •

Copy link
Copy Markdown
Contributor

The most notable change with this request is that ap keys are no longer required and users can now authenticate in a similar fashion to our other APIs.

TODO

  • Docs
  • Unit tests
  • System tests
  • Support model parameter - this needs more discussion as it is a beta feature!

@callmehiphop callmehiphop added don't merge api: translate Issues related to the Cloud Translation API. labels Nov 9, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 9, 2016
@callmehiphop

callmehiphop commented Nov 9, 2016 •

Copy link
Copy Markdown
Contributor Author

@stephenplusplus @jgeewax @omaray @bjwatson The thing I'm missing here is the model parameter, my understanding is that it is in beta and users will have to be whitelisted to use it. Do we want to cut a separate release to support this parameter?

It's just a string, so I think we could probably get away with just adding it here and making note that users need to be whitelisted to use it. WDYT?

@stephenplusplus

Copy link
Copy Markdown
Contributor

Can you link to any docs on what the model property is?

@callmehiphop

Copy link
Copy Markdown
Contributor Author

@stephenplusplus I'm not sure any exists yet :( but it would essentially just be a string that the user supplies.

@callmehiphop

Copy link
Copy Markdown
Contributor Author

Seeing an e2e failure, not sure if it's an actual error or not.

If we send the word Hello! to be translated into Spanish it comes back as ¡Hola!. (This is expected). However when we send the same text in the form of html <body>Hello!</body> we are returned <body>Hola!</body> (The ¡ is no longer present).

@bjwatson

bjwatson commented Nov 9, 2016

Copy link
Copy Markdown

@callmehiphop I've pinged @akeran to see if he has any thoughts on that behavior.

@nikg4

nikg4 commented Nov 9, 2016

Copy link
Copy Markdown

If you set format=html you will get "\u003cbody\u003e ¡Hola! \u003c/body\u003e"
html is the default value for this API, please check that you don't overwrite it to format=text

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling b1c0d25 on callmehiphop:translate-updates into 116436f on GoogleCloudPlatform:master.

@stephenplusplus

Copy link
Copy Markdown
Contributor

Seeing an e2e failure, not sure if it's an actual error or not.

Which test? should autodetect HTML returns what I would expect:

<body> ¡Hola! </body>

@callmehiphop

Copy link
Copy Markdown
Contributor Author

@akeran the assertion we made actually included the html tags wrapping the content - however, it would appear the issue I was seeing disappeared at some point in the night!

Comment thread packages/translate/src/index.js Outdated
* is written in.
* @param {string} options.to - The ISO 639-1 language code to translate the
* input to.
* @param {string} options.model - **Note:** Users must be whitelisted to use

This comment was marked as spam.

This comment was marked as spam.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling b1d2392 on callmehiphop:translate-updates into 116436f on GoogleCloudPlatform:master.

Comment thread packages/translate/README.md Outdated
It's also possible to authenticate with an API key. To create an API key:

1. Visit the [Google Developers Console][dev-console].
2. 2. Create a new project or click on an existing project.

This comment was marked as spam.

This comment was marked as spam.

Comment thread packages/translate/src/index.js Outdated
* is written in.
* @param {string} options.to - The ISO 639-1 language code to translate the
* input to.
* @param {string} options.model - **Note:** Users must be whitelisted to use

This comment was marked as spam.

This comment was marked as spam.

}

var translate = new Translate(extend({}, env, { key: API_KEY }));
describe('translate', function() {

This comment was marked as spam.

This comment was marked as spam.

Comment thread packages/translate/test/index.js Outdated

function FakeService() {
this.calledWith_ = arguments;
Service.apply(this, arguments);

This comment was marked as spam.

This comment was marked as spam.

Comment thread packages/translate/test/index.js Outdated
});

it('should localize the api key', function() {
assert.equal(translate.key, KEY_OPTIONS.key);

This comment was marked as spam.

This comment was marked as spam.

Comment thread packages/translate/test/index.js Outdated
}, /An API key is required to use the Translate API\./);
});
it('should inherit from Service', function() {
assert(translate instanceof Service);

This comment was marked as spam.

This comment was marked as spam.

@coveralls

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 023359d on callmehiphop:translate-updates into * on GoogleCloudPlatform:master*.

baseUrl: baseUrl,
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
packageJson: require('../package.json'),
projectIdRequired: false

This comment was marked as spam.

This comment was marked as spam.

Comment thread packages/translate/src/index.js Outdated
* is written in.
* @param {string} options.model - **Note:** Users must be whitelisted to use
* this parameter. Set the model type requested for this translation. Please
* refer to the upstread documentation for possible values.

This comment was marked as spam.

This comment was marked as spam.

Comment thread packages/translate/src/index.js Outdated
}

if (options.model) {
query.model = options.model;

This comment was marked as spam.

This comment was marked as spam.

a: 'b',
c: 'd',
qs: {
beforeEach(function() {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@coveralls

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling b68c187 on callmehiphop:translate-updates into * on GoogleCloudPlatform:master*.

@stephenplusplus stephenplusplus removed their assignment Nov 14, 2016
@stephenplusplus

Copy link
Copy Markdown
Contributor

Please re-assign if it needs another look.

@stephenplusplus
stephenplusplus merged commit 6e9ae57 into googleapis:master Nov 14, 2016
sofisl pushed a commit that referenced this pull request Nov 10, 2022
miguelvelezsa added a commit that referenced this pull request Jul 23, 2025
* chore: add node 22 and 24 versions in ci tests

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: add retry in linkinator.config

* fix: set concurrency to 1 in linkinator.config

* Update .OwlBot.lock.yaml

* chore: Update .OwlBot.lock.yaml

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: sofisl <[email protected]>
sofisl pushed a commit that referenced this pull request Feb 24, 2026
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 477248447

Source-Link: https://togithub.com/googleapis/googleapis/commit/4689c7380444972caf11fd1b96e7ec1f864b7dfb

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/c4059786a5cd805a0151d95b477fbc486bcbcedc
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzQwNTk3ODZhNWNkODA1YTAxNTFkOTViNDc3ZmJjNDg2YmNiY2VkYyJ9
GautamSharda pushed a commit that referenced this pull request Mar 11, 2026
…is set (#1781)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 551210991

Source-Link: https://togithub.com/googleapis/googleapis/commit/7c762d770a82da397956b80379a6fb73505835af

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/15fe4c5ff5ebd52911b429b05b992e232f53351e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTVmZTRjNWZmNWViZDUyOTExYjQyOWIwNWI5OTJlMjMyZjUzMzUxZSJ9
sofisl added a commit that referenced this pull request Mar 17, 2026
* chore: add node 22 and 24 versions in ci tests

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: add retry in linkinator.config

* fix: set concurrency to 1 in linkinator.config

* Update .OwlBot.lock.yaml

* chore: Update .OwlBot.lock.yaml

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: sofisl <[email protected]>
sofisl pushed a commit that referenced this pull request Mar 17, 2026
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: danieljbruce <[email protected]>
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. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants