translate-subtitles icon indicating copy to clipboard operation
translate-subtitles copied to clipboard

The translation isn’t complete

Open Tizioincognit0 opened this issue 4 years ago • 3 comments

When i’m trying to translate a subtitle file (for example “still-alice”), the first 63 lines are translated but the following ones aren't. I’m getting the following errors and I'm using subtitle_translator on macOS Mojave 10.14.6.

sh-3.2# python run.py /Applications/SRT\ Translator/subtitle_translator 100 google pl it
['/Applications/SRT Translator/subtitle_translator', '100', 'google', 'pl', 'it']
1
00:00:47,140 --> 00:00:49,270
Wszystkiego najlepszego, mamo!
<i>I migliori auguri mamma!</i>

2
00:00:49,280 --> 00:00:53,100
- Dla mnie? - Nie wyglądasz na 40, a co dopiero na 50 lat.
- Per me? 

3
00:00:53,160 --> 00:00:54,270
Bez przesady...
Senza esagerare ...

4
00:00:54,270 --> 00:00:55,260
Ale dziękuję.
Ma grazie.

5
00:00:55,280 --> 00:00:57,610
- Mogę otworzyć? - Tak, proszę!
- Posso aprirlo? 

6
00:00:57,690 --> 00:00:59,150
Mój Boże...
Mio Dio...

7
00:01:02,730 --> 00:01:04,500
- Cudowny! - Podoba ci się?
- Bello! 

8
00:01:04,560 --> 00:01:06,700
- Śliczny!
- Bello!

9
00:01:06,730 --> 00:01:08,900
- Możesz wymienić... - W życiu!
- Puoi sostituire ...
- Nella vita!

10
00:01:08,920 --> 00:01:10,640
- Naprawdę mi się podoba. - Ciesze się.
- Mi piace molto. 

11
00:01:10,870 --> 00:01:12,230
- Przepraszam za spóźnienie.
- Scusa per il ritardo.

12
00:01:12,250 --> 00:01:14,000
- A gdzie Lisa?
- Dov'è Lisa?

13
00:01:15,010 --> 00:01:16,200
Zerwaliśmy.
Ci siamo lasciati.

14
00:01:16,530 --> 00:01:19,940
I znów możesz się chwalić statusem singla.
E puoi vantarti di nuovo dello status di single.

15
00:01:22,040 --> 00:01:24,330
Zapomniałem prezentu. został w domu.
Ho dimenticato il mio regalo. 

16
00:01:24,400 --> 00:01:26,510
Nie szkodzi, mam nadzieję, że nie był drogi.
Non importa, spero non sia stato costoso.

17
00:01:26,510 --> 00:01:28,000
Nie był.
Lui non era.

18
00:01:29,050 --> 00:01:30,090
Gdzie byłeś?
Dove sei stato?

19
00:01:30,160 --> 00:01:35,200
Na ostrym dyżurze trafił nam się facet dźgnięty 6 razy...
Abbiamo avuto un ragazzo accoltellato 6 volte al pronto soccorso ...

20
00:01:35,220 --> 00:01:38,190
- Przestań Tom, nie przy jedzeniu. - Nie widzę byś coś jadła.
- Smettila, Tom, non mangiare. 

21
00:01:38,200 --> 00:01:39,320
Ale zaraz będę.
Ma ci sarò presto.

22
00:01:41,600 --> 00:01:44,760
- Rozmawiałaś z Lidią? - Tak.
- Hai parlato con Lydia? 

23
00:01:44,800 --> 00:01:47,590
Chciała przyjść, ale ma ważne przesłuchanie.
Voleva venire, ma ha un'udienza importante.

24
00:01:47,610 --> 00:01:52,270
- Do czego? - Chyba do telewizji.
- Per cosa? 

25
00:01:52,300 --> 00:01:55,600
- Może to jej wielka szansa. - Może.
- Forse questa è la sua grande occasione. 

26
00:01:55,630 --> 00:01:57,050
Wątpię.
Ne dubito.

27
00:01:58,680 --> 00:01:59,880
Przestań!
Stop!

28
00:01:59,910 --> 00:02:01,990
Skąd to nastawienie?
Da dove viene questo atteggiamento?

29
00:02:02,020 --> 00:02:04,550
Pewnie za młodu siostra psuła ci lalki.
Immagino che tua sorella abbia rovinato le tue bambole quando eri giovane.

30
00:02:04,580 --> 00:02:07,080
Przeciwnie, miałam dobre relacje z siostrą.
Al contrario, ho avuto un buon rapporto con mia sorella.

31
00:02:07,110 --> 00:02:09,990
Chodziło mi o Annę i Lidię.
Intendevo Anna e Lidia.

32
00:02:10,060 --> 00:02:12,370
Boże, nie wiem co mnie naszło.
Dio, non so cosa mi sia preso.

33
00:02:12,630 --> 00:02:14,610
Dzisiaj są twoje urodziny, mamo.
Oggi è il tuo compleanno, mamma.

34
00:02:14,630 --> 00:02:16,160
Więc wznieśmy toast. Tato?
Quindi facciamo un brindisi. 

35
00:02:16,200 --> 00:02:18,610
Tato! Toast!
Papà! 

36
00:02:21,470 --> 00:02:25,450
Za najpiekniejszą i najmądrzejszą kobietę,
Per la donna più bella e più saggia,

37
00:02:25,470 --> 00:02:27,910
jaką w życiu widziałem.
L'ho visto nella mia vita.

38
00:02:30,180 --> 00:02:31,910
- Wszystkiego najlepszego!
- Ti auguro il meglio!

39
00:02:32,080 --> 00:02:33,450
- Kochamy cię! - Ja was też!
- Ti vogliamo bene! 

40
00:02:33,880 --> 00:02:35,590
- Zdrowie!
- Salute!

41
00:02:44,680 --> 00:02:46,320
Nazywam się Frederick Johnson.
<i>Il mio nome è Frederick Johnson.</i>

42
00:02:46,320 --> 00:02:49,500
jestem profesorem językoznastwa na Uniwersytecie Kalifornijskim
<i>Sono un professore di linguistica presso l'Università della California</i>

43
00:02:49,510 --> 00:02:53,020
i chciałbym powitać naszego gościa z Nowego Jorku.
<i>e vorrei dare il benvenuto al nostro ospite da New York.</i>

44
00:02:53,150 --> 00:02:55,060
W swojej pracy doktorskiej
Nella sua tesi di dottorato

45
00:02:55,100 --> 00:02:58,300
pisałem rozdział, w którym cytowałem dzisiejszego gościa
Ho scritto il capitolo citando l'ospite di oggi

46
00:02:58,350 --> 00:03:00,350
i próbowałem dowieść, że się myli.
e ha cercato di dimostrargli che si sbagliava.

47
00:03:02,510 --> 00:03:06,260
Ale zawsze, kiedy się sprzeczaliśmy, to ona miała rację.
Ma ogni volta che abbiamo litigato, aveva ragione.

48
00:03:07,010 --> 00:03:10,720
Alice Howland jest czołowym profesorem lingwistyki
Alice Howland è un'importante professoressa di linguistica

49
00:03:10,780 --> 00:03:13,550
Uniwersytetu Columbia, oraz autorką słynnej książki:
Columbia University e autore del famoso libro:

50
00:03:13,560 --> 00:03:15,520
"Od molekuł do umysłu".
"Dalle molecole alla mente".

51
00:03:15,550 --> 00:03:19,470
Napisała ją wychowując trójkę dzieci. Z pewnością nie było jej łatwo...
L'ha scritto mentre cresceva tre figli. 

52
00:03:19,500 --> 00:03:25,640
Mimo to, jej badania stały się światowym przełomem w dziedzinie lingwistyki.
Tuttavia, la sua ricerca è diventata una svolta mondiale nella linguistica.

53
00:03:26,350 --> 00:03:29,620
Powitajmy doktor Alice Howland!
Diamo il benvenuto alla dottoressa Alice Howland!

54
00:03:34,440 --> 00:03:36,830
Dziękuję.
Grazie.

55
00:03:38,020 --> 00:03:40,340
Większość dzieci jest w stanie zrozumieć
La maggior parte dei bambini può capire

56
00:03:40,340 --> 00:03:42,800
oraz posługiwać się językiem ojczystym
e usa la lingua madre

57
00:03:42,800 --> 00:03:47,790
zanim ukończy 4 lata, bez żadnych lekcji czy zadań.
prima dei 4 anni, senza lezioni o incarichi.

58
00:03:47,810 --> 00:03:50,250
Jak to możliwe?
Com'è possibile?

59
00:03:50,250 --> 00:03:54,200
To pytanie nurtuje naukowców od kiedy Darwin
Questa domanda ha infastidito gli scienziati sin dai tempi di Darwin

60
00:03:54,200 --> 00:03:58,020
zaczął prowadzić dziennik opisujący język swojego miesięcznego syna.
iniziò a tenere un diario che dettagliava la lingua del figlio di un mese.

61
00:03:58,020 --> 00:04:01,630
Zauważył, że mowa jest czymś instynktownym,
Notò che la parola era qualcosa di istintivo,

62
00:04:01,670 --> 00:04:04,660
stąd gaworzenie u dzieci.
da qui il balbettio dei bambini.

63
00:04:04,790 --> 00:04:07,060
Obecnie wiemy na ten temat o wiele więcej,
Ora ne sappiamo molto di più,

64
00:04:07,080 --> 00:04:09,310
Ale dziś pragnę się skupić na
Traceback (most recent call last):
  File "run.py", line 71, in <module>
    translater(sys.argv[1:])
  File "run.py", line 67, in translater
    s.translate_substitle(subFile, source_language, target_language, translator, max_length)
  File "src/subTranslater.py", line 220, in translate_substitle
    translated_sub = self.send_google_translator(prepared_sub, source_language, target_language)
  File "src/subTranslater.py", line 93, in send_google_translator
    return gs.translate(prepared_sub, target_language, source_language)
  File "src/goslate.py", line 336, in translate
    return self._translate_single_text(text, target_language, source_language)
  File "src/goslate.py", line 281, in _translate_single_text
    return ''.join(self._execute(make_task(i) for i in split_text(text)))
  File "src/goslate.py", line 167, in _execute
    yield each()
  File "src/goslate.py", line 279, in <lambda>
    return lambda: self._basic_translate(text, target_language, source_lauguage)
  File "src/goslate.py", line 206, in _basic_translate
    data = response_content.json()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Tizioincognit0 avatar Aug 29 '20 12:08 Tizioincognit0

Unfortunately this is because Google blocks your IP. They changed the security rules and now IP blocking, I added some random sleep between request but this is not enough. There should be some smarter way.

gunesmes avatar Aug 29 '20 17:08 gunesmes

it isn't translating at all now

michalis001 avatar Aug 04 '21 06:08 michalis001

it isn't translating at all now

I'm still able to translate partially.

Unfortunately this is because Google blocks your IP. They changed the security rules and now IP blocking, I added some random sleep between request but this is not enough. There should be some smarter way.

Probably the smarter way is used by https://github.com/SubtitleEdit/subtitleedit which doesn't have this issue and makes complete translations using Google Translate even if it doesn't support batch/bulk translations.

Tizioincognit0 avatar Jan 03 '22 13:01 Tizioincognit0

@Tizioincognit0, I released v2 by implementing raw translation via googletranslatepy. If you have time, please check it and feel free to contribute.

The new version translated a long subtitle successfully.

1420
01:38:46,208 --> 01:38:51,583
<i>Devam et, biz ışık
Atış, kalp devam ediyor</i>

1421
01:38:55,208 --> 01:39:00,541
<i>Devam et, biz ışık</i>
<i>Atım, kalp devam ediyor</i>

Translated by subtitle_translator via google translator
written by Mesut Gunes: https://github.com/gunesmes/subtitle_translator

New file name:  /Users/mesutgunes/Projects/personal/subtitle_translator/An.Unforgettable.Year.Autumn.2023_en_to_tr.srt
Duration: 0:12:46.338071

gunesmes avatar Jun 15 '23 06:06 gunesmes