Softcatala / translation-memory-tools

A set of tools to build, maintain and use translation memories
https://www.softcatala.org/recursos/memories/
29 stars 17 forks source link

Draft: SOGo: new project #344

Closed pereorga closed 9 months ago

pereorga commented 11 months ago

Això afegeix els nous noms de fitxers "English.lproj/Localizable.strings", "Catalan.lproj/Localizable.strings" i restructura el codi corresponent.

El projecte SOGo dona alguns errors relacionats amb els fitxers PHP (que crec que no aplica), i amb la conversió a PO.

$ python3 builder.py -p"SOGo"
Translation memory builder version 0.1
Use --help for assistance
Projects defined in the projects configuration directory 263
S'està clonant a «_git»...
remote: Enumerating objects: 3685, done.
remote: Counting objects: 100% (3685/3685), done.
remote: Compressing objects: 100% (2659/2659), done.
remote: Total 3685 (delta 1360), reused 1973 (delta 536), pack-reused 0
S'estan rebent objectes: 100% (3685/3685), 33.14 MiB | 20.02 MiB/s, fet.
S'estan resolent les diferències: 100% (1360/1360), fet.
processing 1 files...
php2po: WARNING: Couldn't handle input file ca: don't know what to do with input format ., template format .

processing 1 files...
[###########################################] 100%
processing 1 files...
[###########################################] 100%
processing 1 files...
[###########################################] 100%
processing 1 files...
[###########################################] 100%
processing 1 files...
translate.convert.prop2po: ERROR: didn't convert original property definition ''
[###########################################] 100%
processing 1 files...
translate.convert.prop2po: ERROR: didn't convert original property definition ''
[###########################################] 100%
processing 1 files...
[###########################################] 100%
processing 1 files...
translate.convert.prop2po: ERROR: didn't convert original property definition ''
[###########################################] 100%
processing 1 files...
[###########################################] 100%
processing 1 files...
[###########################################] 100%
processing 1 files...
translate.convert.prop2po: ERROR: didn't convert original property definition ''
[###########################################] 100%
ERROR:root:POFile.get_statistics exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/SoObjects/Appointments/ca-apple.po (line 218): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/SoObjects/Appointments/ca-apple.po
ERROR:root:POFile.add_comment_to_all_entries_and_remove_fuzzys exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/SoObjects/Appointments/ca-apple.po (line 218): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/SoObjects/Appointments/ca-apple.po
ERROR:root:POFile.calculate_localized_string_checksum exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/SoObjects/Appointments/ca-apple.po (line 218): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/SoObjects/Appointments/ca-apple.po
ERROR:root:POFile.get_statistics exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Common/ca-apple.po (line 135): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Common/ca-apple.po
ERROR:root:POFile.add_comment_to_all_entries_and_remove_fuzzys exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Common/ca-apple.po (line 135): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Common/ca-apple.po
ERROR:root:POFile.calculate_localized_string_checksum exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Common/ca-apple.po (line 135): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Common/ca-apple.po
ERROR:root:POFile.get_statistics exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Contacts/ca-apple.po (line 633): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Contacts/ca-apple.po
ERROR:root:POFile.add_comment_to_all_entries_and_remove_fuzzys exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Contacts/ca-apple.po (line 633): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Contacts/ca-apple.po
ERROR:root:POFile.calculate_localized_string_checksum exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Contacts/ca-apple.po (line 633): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Contacts/ca-apple.po
ERROR:root:POFile.get_statistics exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/MailerUI/ca-apple.po (line 1134): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/MailerUI/ca-apple.po
ERROR:root:POFile.add_comment_to_all_entries_and_remove_fuzzys exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/MailerUI/ca-apple.po (line 1134): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/MailerUI/ca-apple.po
ERROR:root:POFile.calculate_localized_string_checksum exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/MailerUI/ca-apple.po (line 1134): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/MailerUI/ca-apple.po
ERROR:root:POFile.get_statistics exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Scheduler/ca-apple.po (line 1480): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Scheduler/ca-apple.po
ERROR:root:POFile.add_comment_to_all_entries_and_remove_fuzzys exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Scheduler/ca-apple.po (line 1480): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Scheduler/ca-apple.po
ERROR:root:POFile.calculate_localized_string_checksum exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Scheduler/ca-apple.po (line 1480): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Scheduler/ca-apple.po
ERROR:root:POFile.get_statistics exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/SoObjects/Appointments/ca-apple.po (line 218): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/SoObjects/Appointments/ca-apple.po
ERROR:root:POFile.get_statistics exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Common/ca-apple.po (line 135): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Common/ca-apple.po
ERROR:root:POFile.get_statistics exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Contacts/ca-apple.po (line 633): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Contacts/ca-apple.po
ERROR:root:POFile.get_statistics exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/MailerUI/ca-apple.po (line 1134): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/MailerUI/ca-apple.po
ERROR:root:POFile.get_statistics exception 'Syntax error in po file /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Scheduler/ca-apple.po (line 1480): unescaped double quote found' at /var/folders/ls/d7rgrlcn5ln134pbkk3swnqm0000gn/T/SOGo_wkajghas/UI/Scheduler/ca-apple.po
Projects. Added into tots-tm.po a total of 0 words from 0 projects. Skipped 1 project(s) with 2028 words due to license incompatibility
Projects clean up:0
processing 1 files...
[###########################################] 100%
SOGo project. 503 translated strings, words 2028
Project.get_words_entries exception output/tots-tm.po
Translation memory for all projects is empty. No projects were added.
Time used to build memories: 0:00:06.329446

Els fitxers problemàtics es converteixen correctament passant --duplicates msgctxt, però no hi ha una manera fàcil de poder especificar-ho per projecte:

prop2po -t MailerUI/English.lproj/Localizable.strings -i  MailerUI/Catalan.lproj/Localizable.strings --encoding utf-8 --duplicates msgctxt

No estic segur si aplicar --duplicates msgctxt pot ser menys problemàtic que el que hi ha ara (--duplicates merge), pel que veig per aquest projecte funcionaria.

jordimas commented 11 months ago

Hola Pere!

L'error d'PHP el pots ignorar, és un fals positiu.

El problema està aquí:

ERROR:root:POFile.get_statistics exception 'Syntax error in po file

és greu. Indica que el no pot llegir el fitxer PO, en aquest cas perquè un conversor generà un fitxer no vàlid.

En el fitxer:

SoObjects/Appointments/Catalan.lproj/Localizable.strings

Hi ha cadenes com:

/ Update / "The appointment \"%{Summary}\" for the %{OldStartDate} has changed" = "La cita \"%{Summary}\" per al dia %{OldStartDate} ha canviat";

Que no importa bé. O les cadenes no estan ben escapades:

unescaped double quote found

Cal entendre com escapa el format Apple strings. Probablement el conversor no gestiona bé el cas. Si és així, caldria esmenar-ho a translate-toolkit. Puc ajudar a mirar-ho.

pereorga commented 11 months ago

Això té sentit. Però sembla que les cometes s'escapen correctament amb msgctxt. Fins i tot pels fitxers que no donen error, sembla que msgctxt dona més bons resultats, afegint el context