or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

index.mdv2-legacy-api.mdv3-adaptive-mt.mdv3-automl-translation.mdv3-data-structures.mdv3-glossary-management.mdv3-request-response-types.mdv3-translation-services.md

v3-request-response-types.mddocs/

0

# V3 Request and Response Types

1

2

Complete type definitions for all request and response objects used across the V3 API. These types define the structure of data sent to and received from the Google Cloud Translation API V3 endpoints.

3

4

## Core Import

5

6

```python

7

from google.cloud import translate_v3

8

```

9

10

## Translation Request and Response Types

11

12

### Text Translation

13

14

```python { .api }

15

class TranslateTextRequest:

16

"""

17

Request message for TranslateText method.

18

19

Attributes:

20

contents (list): Text content to translate (required)

21

mime_type (str): MIME type of content ('text/plain' or 'text/html')

22

source_language_code (str): Source language code (BCP-47)

23

target_language_code (str): Target language code (BCP-47, required)

24

parent (str): Project/location resource name (required)

25

model (str): Custom model to use for translation

26

glossary_config (TranslateTextGlossaryConfig): Glossary configuration

27

transliteration_config (TransliterationConfig): Transliteration configuration

28

labels (dict): Labels for request tracking

29

"""

30

31

class TranslateTextResponse:

32

"""

33

Response message for TranslateText method.

34

35

Attributes:

36

translations (list): List of Translation objects

37

glossary_translations (list): Translations using glossary

38

language_code (str): Detected source language code

39

"""

40

41

class Translation:

42

"""

43

A single translation response.

44

45

Attributes:

46

translated_text (str): Translated text

47

model (str): Model used for translation

48

detected_language_code (str): Detected source language

49

glossary_config (TranslateTextGlossaryConfig): Applied glossary configuration

50

"""

51

```

52

53

### Document Translation

54

55

```python { .api }

56

class TranslateDocumentRequest:

57

"""

58

Request message for TranslateDocument method.

59

60

Attributes:

61

parent (str): Project/location resource name (required)

62

source_language_code (str): Source language code

63

target_language_code (str): Target language code (required)

64

document_input_config (DocumentInputConfig): Document input configuration (required)

65

document_output_config (DocumentOutputConfig): Document output configuration

66

model (str): Custom model to use

67

glossary_config (TranslateTextGlossaryConfig): Glossary configuration

68

labels (dict): Labels for request tracking

69

customized_attribution (str): Attribution for customized model

70

is_translate_native_pdf_only (bool): Translate native PDFs only

71

enable_shadow_removal_native_pdf (bool): Enable shadow removal for PDFs

72

enable_rotation_correction (bool): Enable rotation correction

73

"""

74

75

class TranslateDocumentResponse:

76

"""

77

Response message for TranslateDocument method.

78

79

Attributes:

80

document_translation (DocumentTranslation): Document translation result

81

glossary_document_translation (DocumentTranslation): Translation using glossary

82

model (str): Model used for translation

83

glossary_config (TranslateTextGlossaryConfig): Applied glossary configuration

84

"""

85

86

class DocumentTranslation:

87

"""

88

Document translation result.

89

90

Attributes:

91

byte_stream_outputs (list): Translated document content

92

mime_type (str): MIME type of output

93

detected_language_code (str): Detected source language

94

"""

95

```

96

97

### Language Detection

98

99

```python { .api }

100

class DetectLanguageRequest:

101

"""

102

Request message for DetectLanguage method.

103

104

Attributes:

105

parent (str): Project/location resource name (required)

106

model (str): Optional model to use for detection

107

content (str): Text content to analyze

108

mime_type (str): MIME type of content

109

labels (dict): Labels for request tracking

110

"""

111

112

class DetectLanguageResponse:

113

"""

114

Response message for DetectLanguage method.

115

116

Attributes:

117

languages (list): List of DetectedLanguage objects

118

"""

119

120

class DetectedLanguage:

121

"""

122

Language detection result.

123

124

Attributes:

125

language_code (str): Detected language code (BCP-47)

126

confidence (float): Detection confidence score (0.0 to 1.0)

127

"""

128

```

129

130

### Supported Languages

131

132

```python { .api }

133

class GetSupportedLanguagesRequest:

134

"""

135

Request message for GetSupportedLanguages method.

136

137

Attributes:

138

parent (str): Project/location resource name (required)

139

display_language_code (str): Language code for language names

140

model (str): Optional model to get languages for

141

"""

142

143

class SupportedLanguages:

144

"""

145

Response message for GetSupportedLanguages method.

146

147

Attributes:

148

languages (list): List of SupportedLanguage objects

149

"""

150

151

class SupportedLanguage:

152

"""

153

A supported language.

154

155

Attributes:

156

language_code (str): Language code (BCP-47)

157

display_name (str): Human-readable language name

158

support_source (bool): Can be used as source language

159

support_target (bool): Can be used as target language

160

"""

161

```

162

163

### Text Romanization

164

165

```python { .api }

166

class RomanizeTextRequest:

167

"""

168

Request message for RomanizeText method.

169

170

Attributes:

171

parent (str): Project/location resource name (required)

172

contents (list): Text content to romanize (required)

173

source_language_code (str): Source language code

174

"""

175

176

class RomanizeTextResponse:

177

"""

178

Response message for RomanizeText method.

179

180

Attributes:

181

romanizations (list): List of Romanization objects

182

"""

183

184

class Romanization:

185

"""

186

Romanization result.

187

188

Attributes:

189

romanized_text (str): Romanized text in Latin script

190

detected_language_code (str): Detected source language

191

"""

192

```

193

194

## Batch Operation Types

195

196

### Batch Text Translation

197

198

```python { .api }

199

class BatchTranslateTextRequest:

200

"""

201

Request message for BatchTranslateText method.

202

203

Attributes:

204

parent (str): Project/location resource name (required)

205

source_language_code (str): Source language code (required)

206

target_language_codes (list): List of target language codes (required)

207

input_configs (list): List of input configurations (required)

208

output_config (OutputConfig): Output configuration (required)

209

models (dict): Custom models for specific language pairs

210

glossaries (dict): Glossaries for specific language pairs

211

labels (dict): Labels for request tracking

212

"""

213

214

class BatchTranslateResponse:

215

"""

216

Response message for BatchTranslateText method.

217

218

Attributes:

219

total_characters (int): Total characters processed

220

translated_characters (int): Successfully translated characters

221

failed_characters (int): Failed translation characters

222

submit_time (Timestamp): Operation submit time

223

end_time (Timestamp): Operation end time

224

"""

225

226

class BatchTranslateMetadata:

227

"""

228

Metadata for batch translation operation.

229

230

Attributes:

231

state (OperationState): Current operation state

232

translated_characters (int): Characters translated so far

233

failed_characters (int): Characters that failed translation

234

total_characters (int): Total characters to translate

235

submit_time (Timestamp): Operation submit time

236

"""

237

```

238

239

### Batch Document Translation

240

241

```python { .api }

242

class BatchTranslateDocumentRequest:

243

"""

244

Request message for BatchTranslateDocument method.

245

246

Attributes:

247

parent (str): Project/location resource name (required)

248

source_language_code (str): Source language code (required)

249

target_language_codes (list): List of target language codes (required)

250

input_configs (list): List of batch document input configurations (required)

251

output_config (BatchDocumentOutputConfig): Output configuration (required)

252

models (dict): Custom models for specific language pairs

253

glossaries (dict): Glossaries for specific language pairs

254

format_conversions (dict): Format conversion specifications

255

customized_attribution (str): Attribution for customized model

256

enable_shadow_removal_native_pdf (bool): Enable shadow removal for PDFs

257

enable_rotation_correction (bool): Enable rotation correction

258

"""

259

260

class BatchTranslateDocumentResponse:

261

"""

262

Response message for BatchTranslateDocument method.

263

264

Attributes:

265

total_pages (int): Total pages processed

266

translated_pages (int): Successfully translated pages

267

failed_pages (int): Failed translation pages

268

total_billable_pages (int): Total billable pages

269

submit_time (Timestamp): Operation submit time

270

end_time (Timestamp): Operation end time

271

"""

272

273

class BatchTranslateDocumentMetadata:

274

"""

275

Metadata for batch document translation operation.

276

277

Attributes:

278

state (OperationState): Current operation state

279

total_pages (int): Total pages to translate

280

translated_pages (int): Pages translated so far

281

failed_pages (int): Pages that failed translation

282

total_billable_pages (int): Total billable pages

283

submit_time (Timestamp): Operation submit time

284

"""

285

```

286

287

## Glossary Request and Response Types

288

289

### Glossary Management

290

291

```python { .api }

292

class CreateGlossaryRequest:

293

"""

294

Request message for CreateGlossary method.

295

296

Attributes:

297

parent (str): Project/location resource name (required)

298

glossary (Glossary): Glossary configuration (required)

299

"""

300

301

class UpdateGlossaryRequest:

302

"""

303

Request message for UpdateGlossary method.

304

305

Attributes:

306

glossary (Glossary): Updated glossary configuration (required)

307

update_mask (FieldMask): Fields to update

308

"""

309

310

class ListGlossariesRequest:

311

"""

312

Request message for ListGlossaries method.

313

314

Attributes:

315

parent (str): Project/location resource name (required)

316

page_size (int): Maximum number of glossaries to return

317

page_token (str): Token for pagination

318

filter (str): Filter expression for glossaries

319

"""

320

321

class ListGlossariesResponse:

322

"""

323

Response message for ListGlossaries method.

324

325

Attributes:

326

glossaries (list): List of Glossary objects

327

next_page_token (str): Token for next page

328

"""

329

330

class GetGlossaryRequest:

331

"""

332

Request message for GetGlossary method.

333

334

Attributes:

335

name (str): Glossary resource name (required)

336

"""

337

338

class DeleteGlossaryRequest:

339

"""

340

Request message for DeleteGlossary method.

341

342

Attributes:

343

name (str): Glossary resource name (required)

344

"""

345

346

class DeleteGlossaryResponse:

347

"""

348

Response message for DeleteGlossary method.

349

350

Attributes:

351

name (str): Deleted glossary name

352

submit_time (Timestamp): Operation submit time

353

end_time (Timestamp): Operation end time

354

"""

355

```

356

357

### Glossary Entry Management

358

359

```python { .api }

360

class CreateGlossaryEntryRequest:

361

"""

362

Request message for CreateGlossaryEntry method.

363

364

Attributes:

365

parent (str): Glossary resource name (required)

366

glossary_entry (GlossaryEntry): Entry configuration (required)

367

"""

368

369

class UpdateGlossaryEntryRequest:

370

"""

371

Request message for UpdateGlossaryEntry method.

372

373

Attributes:

374

glossary_entry (GlossaryEntry): Updated entry configuration (required)

375

"""

376

377

class ListGlossaryEntriesRequest:

378

"""

379

Request message for ListGlossaryEntries method.

380

381

Attributes:

382

parent (str): Glossary resource name (required)

383

page_size (int): Maximum number of entries to return

384

page_token (str): Token for pagination

385

"""

386

387

class ListGlossaryEntriesResponse:

388

"""

389

Response message for ListGlossaryEntries method.

390

391

Attributes:

392

glossary_entries (list): List of GlossaryEntry objects

393

next_page_token (str): Token for next page

394

"""

395

396

class GetGlossaryEntryRequest:

397

"""

398

Request message for GetGlossaryEntry method.

399

400

Attributes:

401

name (str): Glossary entry resource name (required)

402

"""

403

404

class DeleteGlossaryEntryRequest:

405

"""

406

Request message for DeleteGlossaryEntry method.

407

408

Attributes:

409

name (str): Glossary entry resource name (required)

410

"""

411

```

412

413

## Configuration and Input/Output Types

414

415

### Document Configuration

416

417

```python { .api }

418

class DocumentInputConfig:

419

"""

420

Document input configuration.

421

422

Attributes:

423

content (bytes): Document content as bytes

424

gcs_source (GcsSource): Google Cloud Storage source

425

mime_type (str): Document MIME type (required)

426

"""

427

428

class DocumentOutputConfig:

429

"""

430

Document output configuration.

431

432

Attributes:

433

gcs_destination (GcsDestination): Google Cloud Storage destination

434

mime_type (str): Output MIME type

435

"""

436

437

class BatchDocumentInputConfig:

438

"""

439

Batch document input configuration.

440

441

Attributes:

442

gcs_source (GcsSource): Google Cloud Storage source (required)

443

mime_type (str): Document MIME type (required)

444

"""

445

446

class BatchDocumentOutputConfig:

447

"""

448

Batch document output configuration.

449

450

Attributes:

451

gcs_destination (GcsDestination): Google Cloud Storage destination (required)

452

"""

453

```

454

455

### Storage Configuration

456

457

```python { .api }

458

class InputConfig:

459

"""

460

Input configuration for batch operations.

461

462

Attributes:

463

mime_type (str): Input MIME type

464

gcs_source (GcsSource): Google Cloud Storage source

465

"""

466

467

class OutputConfig:

468

"""

469

Output configuration for batch operations.

470

471

Attributes:

472

gcs_destination (GcsDestination): Google Cloud Storage destination (required)

473

"""

474

475

class GcsSource:

476

"""

477

Google Cloud Storage source.

478

479

Attributes:

480

input_uri (str): GCS URI (gs://bucket/path)

481

"""

482

483

class GcsDestination:

484

"""

485

Google Cloud Storage destination.

486

487

Attributes:

488

output_uri_prefix (str): GCS URI prefix for output

489

"""

490

```

491

492

### Glossary Configuration

493

494

```python { .api }

495

class TranslateTextGlossaryConfig:

496

"""

497

Glossary configuration for translation.

498

499

Attributes:

500

glossary (str): Glossary resource name (required)

501

ignore_case (bool): Whether to ignore case when matching

502

"""

503

504

class GlossaryInputConfig:

505

"""

506

Glossary input configuration.

507

508

Attributes:

509

gcs_source (GcsSource): Google Cloud Storage source (required)

510

mime_type (str): Glossary MIME type (required)

511

"""

512

```

513

514

### Transliteration Configuration

515

516

```python { .api }

517

class TransliterationConfig:

518

"""

519

Transliteration configuration.

520

521

Attributes:

522

enable_transliteration (bool): Whether to enable transliteration (required)

523

"""

524

```