Skip to content

Commit

Permalink
Merge pull request #3520 from googleapis/nodejs-translate-migration
Browse files Browse the repository at this point in the history
migrate code from googleapis/nodejs-translate
  • Loading branch information
sofisl authored Nov 10, 2022
2 parents 5aabc1a + c87e9ba commit ee989ff
Show file tree
Hide file tree
Showing 75 changed files with 75,995 additions and 0 deletions.
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"packages/google-cloud-resourcemanager": "4.1.3",
"packages/google-cloud-security-publicca": "0.1.3",
"packages/google-cloud-shell": "2.0.4",
"packages/google-cloud-translate": "7.0.4",
"packages/google-cloud-videointelligence": "4.1.1",
"packages/google-devtools-artifactregistry": "2.0.2",
"packages/google-iam": "0.2.2",
Expand Down
24 changes: 24 additions & 0 deletions packages/google-cloud-translate/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


deep-remove-regex:
- /owl-bot-staging

deep-copy-regex:
- source: /google/cloud/translate/(v.*)/.*-nodejs
dest: /owl-bot-staging/google-cloud-translate/$1

begin-after-commit-hash: f43939eac6a0bb5998c1fa0f79063194e699230e

7 changes: 7 additions & 0 deletions packages/google-cloud-translate/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/node_modules
**/coverage
test/fixtures
build/
docs/
protos/
samples/generated/
3 changes: 3 additions & 0 deletions packages/google-cloud-translate/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/gts"
}
4 changes: 4 additions & 0 deletions packages/google-cloud-translate/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.ts text eol=lf
*.js text eol=lf
protos/* linguist-generated
**/api-extractor.json linguist-language=JSON-with-Comments
14 changes: 14 additions & 0 deletions packages/google-cloud-translate/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
**/*.log
**/node_modules
.coverage
coverage
.nyc_output
docs/
out/
build/
system-test/secrets.js
system-test/*key.json
*.lock
.DS_Store
package-lock.json
__pycache__
55 changes: 55 additions & 0 deletions packages/google-cloud-translate/.jsdoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **

'use strict';

module.exports = {
opts: {
readme: './README.md',
package: './package.json',
template: './node_modules/jsdoc-fresh',
recurse: true,
verbose: true,
destination: './docs/'
},
plugins: [
'plugins/markdown',
'jsdoc-region-tag'
],
source: {
excludePattern: '(^|\\/|\\\\)[._]',
include: [
'build/src',
'protos'
],
includePattern: '\\.js$'
},
templates: {
copyright: 'Copyright 2022 Google LLC',
includeDate: false,
sourceFiles: false,
systemName: '@google-cloud/translate',
theme: 'lumen',
default: {
outputSourceFiles: false
}
},
markdown: {
idInHeadings: true
}
};
29 changes: 29 additions & 0 deletions packages/google-cloud-translate/.mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const config = {
"enable-source-maps": true,
"throw-deprecation": true,
"timeout": 10000,
"recursive": true
}
if (process.env.MOCHA_THROW_DEPRECATION === 'false') {
delete config['throw-deprecation'];
}
if (process.env.MOCHA_REPORTER) {
config.reporter = process.env.MOCHA_REPORTER;
}
if (process.env.MOCHA_REPORTER_OUTPUT) {
config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`;
}
module.exports = config
24 changes: 24 additions & 0 deletions packages/google-cloud-translate/.nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"report-dir": "./.coverage",
"reporter": ["text", "lcov"],
"exclude": [
"**/*-test",
"**/.coverage",
"**/apis",
"**/benchmark",
"**/conformance",
"**/docs",
"**/samples",
"**/scripts",
"**/protos",
"**/test",
"**/*.d.ts",
".jsdoc.js",
"**/.jsdoc.js",
"karma.conf.js",
"webpack-tests.config.js",
"webpack.config.js"
],
"exclude-after-remap": false,
"all": true
}
6 changes: 6 additions & 0 deletions packages/google-cloud-translate/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/node_modules
**/coverage
test/fixtures
build/
docs/
protos/
17 changes: 17 additions & 0 deletions packages/google-cloud-translate/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

module.exports = {
...require('gts/.prettierrc.json')
}
68 changes: 68 additions & 0 deletions packages/google-cloud-translate/.readme-partials.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
introduction: |-
The [Cloud Translation API](https://cloud.google.com/translate/docs/),
can dynamically translate text between thousands
of language pairs. The Cloud Translation API lets websites and programs
integrate with the translation service programmatically. The Cloud Translation
API is part of the larger Cloud Machine Learning API family.
samples_body: |-
### Choosing between Advanced v3 and Basic v2
Basic supports language detection and text translation [Cloud Translation - Basic v2](https://cloud.google.com/translate/docs/editions#basic).
The advanced edition of [Cloud Translation - V3](https://cloud.google.com/translate/docs/editions#advanced) is optimized for customization and long form content use cases including glossary, batch, and model selection.
### Translate V3 Beta Samples
#### Install Dependencies
From the [root directory](https://github.com/googleapis/nodejs-translate) of the client library install the dependencies:
```
npm install
```
Change to the samples directory, link the google-cloud/translate library from the parent, and install its dependencies:
```
cd samples/
npm link ../
npm install
```
#### Run the Tests
To run the tests for the entire sample, run
```
npm test
```
To run the tests for only the translate v3 samples, run
```
npm run test-v3
```
To run the tests for a single translate v3 sample, run this command, substituting FILE_NAME with the name of a valid test file.
```
./node_modules/.bin/mocha test/v3beta1/FILE_NAME
```
For example, to test the `translate_list_language_names_beta` sample, the command would be
```
./node_modules/.bin/mocha test/v3beta1/translate_list_language_names_beta.test.js
```
To run a sample directly, call the file with the `node` command and any required CLI arguments:
```
node v3beta1/FILE_NAME <CLI argument 0> <CLI argument 1>
```
For example, to run the `translate_list_codes_beta` sample, you would run the following command, substituting your project ID in place of "your_project_id"
```
node v3beta1/translate_list_codes_beta.js "your_project_id"
```
17 changes: 17 additions & 0 deletions packages/google-cloud-translate/.repo-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"distribution_name": "@google-cloud/translate",
"release_level": "stable",
"product_documentation": "https://cloud.google.com/translate/docs/",
"repo": "googleapis/google-cloud-node",
"default_version": "v3",
"language": "nodejs",
"requires_billing": true,
"issue_tracker": "https://issuetracker.google.com/savedsearches/559749",
"client_documentation": "https://cloud.google.com/nodejs/docs/reference/translate/latest",
"name": "translate",
"name_pretty": "Cloud Translation",
"api_id": "translate.googleapis.com",
"codeowner_team": "@googleapis/ml-apis",
"api_shortname": "translate",
"library_type": "GAPIC_AUTO"
}
Loading

0 comments on commit ee989ff

Please sign in to comment.