Skip to content

Commit 8307ad0

Browse files
authored
chore(cloud-rad): Add code fencing (#743)
Code examples need code fencing around them to distingish from rich text for TSDoc. Internally b/179483748 Script used: https://github.com/fhinkel/cloud-rad-script/blob/main/fixExampleComments.js
1 parent 32021fd commit 8307ad0

File tree

4 files changed

+77
-8
lines changed

4 files changed

+77
-8
lines changed

packages/google-cloud-translate/src/index.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,35 @@ import * as v2 from './v2';
2929
* @module {constructor} @google-cloud/translate
3030
* @alias nodejs-translate
3131
*
32-
* @example <caption>Install the v3 client library with <a
33-
* href="https://www.npmjs.com/">npm</a>:</caption>
32+
* @example Install the v3 client library with <a href="https://www.npmjs.com/">npm</a>:
33+
* ```
3434
* npm install --save @google-cloud/translate
3535
*
36-
* @example <caption>Import the v3 client library:</caption>
36+
* ```
37+
* @example Import the v3 client library:
38+
* ```
3739
* const {TranslationServiceClient} = require('@google-cloud/translate');
3840
*
39-
* @example <caption>Create a v3 client that uses <a
40-
* href="https://goo.gl/64dyYX">Application Default Credentials
41-
* (ADC)</a>:</caption>
41+
* ```
42+
* @example Create a v3 client that uses <a href="https://goo.gl/64dyYX">Application Default Credentials (ADC)</a>:
43+
* ```
4244
* const client = new TranslationServiceClient();
4345
*
46+
* ```
4447
* @example <caption>include:samples/quickstart.js</caption>
4548
* region_tag:translate_quickstart
4649
* Full quickstart example:
4750
*
48-
* @example <caption>Install the v3beta1 client library:</caption>
51+
* @example Install the v3beta1 client library:
52+
* ```
4953
* npm install --save @google-cloud/translate
5054
*
51-
* @example <caption>Import the v3beta1 client library:</caption>
55+
* ```
56+
* @example Import the v3beta1 client library:
57+
* ```
5258
* const {TranslationServiceClient} =
5359
* require('@google-cloud/translate').v3beta1;
60+
* ```
5461
*/
5562
import * as v3beta1 from './v3beta1';
5663
import * as v3 from './v3';

packages/google-cloud-translate/src/v2/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,15 @@ export interface TranslateConfig extends GoogleAuthOptions {
118118
* @param {ClientConfig} [options] Configuration options.
119119
*
120120
* @example
121+
* ```
121122
* //-
122123
* // <h3>Custom Translation API</h3>
123124
* //
124125
* // The environment variable, `GOOGLE_CLOUD_TRANSLATE_ENDPOINT`, is honored as
125126
* // a custom backend which our library will send requests to.
126127
* //-
127128
*
129+
* ```
128130
* @example <caption>include:samples/quickstart.js</caption>
129131
* region_tag:translate_quickstart
130132
* Full quickstart example:
@@ -188,6 +190,7 @@ export class Translate extends Service {
188190
* @returns {Promise<DetectResponse>}
189191
*
190192
* @example
193+
* ```
191194
* const {Translate} = require('@google-cloud/translate');
192195
*
193196
* const translate = new Translate();
@@ -237,6 +240,7 @@ export class Translate extends Service {
237240
* const apiResponse = data[2];
238241
* });
239242
*
243+
* ```
240244
* @example <caption>include:samples/translate.js</caption>
241245
* region_tag:translate_detect_language
242246
* Here's a full example:
@@ -439,6 +443,7 @@ export class Translate extends Service {
439443
* @returns {Promise<TranslateResponse>}
440444
*
441445
* @example
446+
* ```
442447
* //-
443448
* // Pass a string and a language code to get the translation.
444449
* //-
@@ -489,6 +494,7 @@ export class Translate extends Service {
489494
* const apiResponse = data[1];
490495
* });
491496
*
497+
* ```
492498
* @example <caption>include:samples/translate.js</caption>
493499
* region_tag:translate_translate_text
494500
* Full translation example:

packages/google-cloud-translate/src/v3/translation_service_client.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,9 @@ export class TranslationServiceClient {
504504
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods| documentation}
505505
* for more details and examples.
506506
* @example
507+
* ```
507508
* const [response] = await client.translateText(request);
509+
* ```
508510
*/
509511
translateText(
510512
request?: protos.google.cloud.translation.v3.ITranslateTextRequest,
@@ -630,7 +632,9 @@ export class TranslationServiceClient {
630632
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods| documentation}
631633
* for more details and examples.
632634
* @example
635+
* ```
633636
* const [response] = await client.detectLanguage(request);
637+
* ```
634638
*/
635639
detectLanguage(
636640
request?: protos.google.cloud.translation.v3.IDetectLanguageRequest,
@@ -754,7 +758,9 @@ export class TranslationServiceClient {
754758
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods| documentation}
755759
* for more details and examples.
756760
* @example
761+
* ```
757762
* const [response] = await client.getSupportedLanguages(request);
763+
* ```
758764
*/
759765
getSupportedLanguages(
760766
request?: protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest,
@@ -905,7 +911,9 @@ export class TranslationServiceClient {
905911
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods| documentation}
906912
* for more details and examples.
907913
* @example
914+
* ```
908915
* const [response] = await client.translateDocument(request);
916+
* ```
909917
*/
910918
translateDocument(
911919
request?: protos.google.cloud.translation.v3.ITranslateDocumentRequest,
@@ -993,7 +1001,9 @@ export class TranslationServiceClient {
9931001
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods| documentation}
9941002
* for more details and examples.
9951003
* @example
1004+
* ```
9961005
* const [response] = await client.getGlossary(request);
1006+
* ```
9971007
*/
9981008
getGlossary(
9991009
request?: protos.google.cloud.translation.v3.IGetGlossaryRequest,
@@ -1146,8 +1156,10 @@ export class TranslationServiceClient {
11461156
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
11471157
* for more details and examples.
11481158
* @example
1159+
* ```
11491160
* const [operation] = await client.batchTranslateText(request);
11501161
* const [response] = await operation.promise();
1162+
* ```
11511163
*/
11521164
batchTranslateText(
11531165
request?: protos.google.cloud.translation.v3.IBatchTranslateTextRequest,
@@ -1207,10 +1219,12 @@ export class TranslationServiceClient {
12071219
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
12081220
* for more details and examples.
12091221
* @example
1222+
* ```
12101223
* const decodedOperation = await checkBatchTranslateTextProgress(name);
12111224
* console.log(decodedOperation.result);
12121225
* console.log(decodedOperation.done);
12131226
* console.log(decodedOperation.metadata);
1227+
* ```
12141228
*/
12151229
async checkBatchTranslateTextProgress(
12161230
name: string
@@ -1346,8 +1360,10 @@ export class TranslationServiceClient {
13461360
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
13471361
* for more details and examples.
13481362
* @example
1363+
* ```
13491364
* const [operation] = await client.batchTranslateDocument(request);
13501365
* const [response] = await operation.promise();
1366+
* ```
13511367
*/
13521368
batchTranslateDocument(
13531369
request?: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest,
@@ -1411,10 +1427,12 @@ export class TranslationServiceClient {
14111427
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
14121428
* for more details and examples.
14131429
* @example
1430+
* ```
14141431
* const decodedOperation = await checkBatchTranslateDocumentProgress(name);
14151432
* console.log(decodedOperation.result);
14161433
* console.log(decodedOperation.done);
14171434
* console.log(decodedOperation.metadata);
1435+
* ```
14181436
*/
14191437
async checkBatchTranslateDocumentProgress(
14201438
name: string
@@ -1494,8 +1512,10 @@ export class TranslationServiceClient {
14941512
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
14951513
* for more details and examples.
14961514
* @example
1515+
* ```
14971516
* const [operation] = await client.createGlossary(request);
14981517
* const [response] = await operation.promise();
1518+
* ```
14991519
*/
15001520
createGlossary(
15011521
request?: protos.google.cloud.translation.v3.ICreateGlossaryRequest,
@@ -1555,10 +1575,12 @@ export class TranslationServiceClient {
15551575
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
15561576
* for more details and examples.
15571577
* @example
1578+
* ```
15581579
* const decodedOperation = await checkCreateGlossaryProgress(name);
15591580
* console.log(decodedOperation.result);
15601581
* console.log(decodedOperation.done);
15611582
* console.log(decodedOperation.metadata);
1583+
* ```
15621584
*/
15631585
async checkCreateGlossaryProgress(
15641586
name: string
@@ -1637,8 +1659,10 @@ export class TranslationServiceClient {
16371659
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
16381660
* for more details and examples.
16391661
* @example
1662+
* ```
16401663
* const [operation] = await client.deleteGlossary(request);
16411664
* const [response] = await operation.promise();
1665+
* ```
16421666
*/
16431667
deleteGlossary(
16441668
request?: protos.google.cloud.translation.v3.IDeleteGlossaryRequest,
@@ -1698,10 +1722,12 @@ export class TranslationServiceClient {
16981722
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations| documentation}
16991723
* for more details and examples.
17001724
* @example
1725+
* ```
17011726
* const decodedOperation = await checkDeleteGlossaryProgress(name);
17021727
* console.log(decodedOperation.result);
17031728
* console.log(decodedOperation.done);
17041729
* console.log(decodedOperation.metadata);
1730+
* ```
17051731
*/
17061732
async checkDeleteGlossaryProgress(
17071733
name: string
@@ -1955,10 +1981,12 @@ export class TranslationServiceClient {
19551981
* {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination| documentation}
19561982
* for more details and examples.
19571983
* @example
1984+
* ```
19581985
* const iterable = client.listGlossariesAsync(request);
19591986
* for await (const response of iterable) {
19601987
* // process response
19611988
* }
1989+
* ```
19621990
*/
19631991
listGlossariesAsync(
19641992
request?: protos.google.cloud.translation.v3.IListGlossariesRequest,

0 commit comments

Comments
 (0)