This repository was archived by the owner on Oct 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy path.readme-partials.yml
More file actions
68 lines (47 loc) · 2.11 KB
/
.readme-partials.yml
File metadata and controls
68 lines (47 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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"
```