'Add Glossary to Google translte V3 API by python
I am trying to add a glossary by CSV. I put the CSV on my google storage. I got this Error:
google.api_core.exceptions.InvalidArgument: 400 Failed to parse content of input file. Error: Not enough valid languages in CSV file. Must have terms for at least two different languages. num_valid_languages_in_csv = 0
my CSV is super simple. I made sure I save in utf-8. I also added # -*- coding: utf-8 -*-
on top of my code.
Liz, 栗子
Tom, 汤姆
Nancy,楠西
The code is copied from the document.
Solution 1:[1]
I also encounter your error when using the CSV you provided. This is because the CSV file used does not have a header.
To fix this just add a header on your CSV file. Make sure you match the headers with your language code defined in your code.
test_glossary_1.csv:
en,zh
Liz, ??
Tom, ??
Nancy???
Solution 2:[2]
Suppose the link
https://storage.googleapis.com/vcc_translation/glossory_01.csv
Now, to make this work, re-write the same as follows:
gs://vcc_translation/glossory_01.csv
Where:
gs://
added from your sidevcc_translation
is the storage bucket
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Jeremy Caney |