bruvellu / cifonauta

Marine biology image database by CEBIMar/USP
http://cifonauta.cebimar.usp.br
GNU General Public License v3.0
21 stars 5 forks source link

Translate remaining untranslated and fuzzy strings #316

Open bruvellu opened 1 month ago

bruvellu commented 1 month ago

There are strings in the latest templates and code that are not yet translated. For example:

In addition, there are fields in Media and other models that have duplicated translations.

This issue depends on addressing:

bruvellu commented 1 month ago

Made the strings translatable in e5f1740938c56046310502e97eea8cf88eb1b191.

bruvellu commented 1 month ago

When clearing duplicated translations (#311), I found captions in English without a Portuguese version. Alvaro and Virginia helped to revise these entries on a spreadsheet, and I imported them to the database by parsing a TSV file and updating the models. See below:

>>> import csv
>>> data = []
>>> with open('caption_trans.tsv', 'r', newline='', encoding='utf-8') as tsv_files:
...  tsv_reader = csv.DictReader(tsv_files, delimiter='\t')
...  for row in tsv_reader:
...   data.append(row)
... 
>>> data
[
{'caption_en_old': '15-day-old medusa.', 'caption_en_new': '15-day-old medusa.', 'caption_pt_br': 'Medusa com 15 dias de vida.'},
{'caption_en_old': '18-chaetiger pelagic larva.', 'caption_en_new': '18-chaetiger pelagic larva.', 'caption_pt_br': 'Larva pelágica de 18 setígeros.'},
{'caption_en_old': '6-chaetiger pelagic larva.', 'caption_en_new': '6-chaetiger pelagic larva.', 'caption_pt_br': 'Larva pelágica de 6 setígeros.'},
(...)
]

>>> for d in data:
...  Media.objects.filter(caption_en=d['caption_en_old']).update(caption_pt_br=d['caption_pt_br'])
...  Media.objects.filter(caption_en=d['caption_en_old']).update(caption_en=d['caption_en_new'])
... 
bruvellu commented 1 month ago

Image

The translation string was too complicated. I simplified it in 6ed0e8f18d88ed1e794d736b5ad92e5d9657a981.

bruvellu commented 1 month ago

The last thing is to zero out the fuzzy and untranslated strings in Meta to reach 100% progress.

Image

The updated Portuguese fields are showing up as untranslated, but I'll synchronize these fields using the model_translator_sync_values.

bruvellu commented 1 month ago

Synchronization worked quite well after 1fd98b32b2cd23db02bae23de9f61930d147faa1 where I resolved some issues with duplicated entries from Media fields on the pofile propagating to the database. Now what's left on Rosetta is mostly regular translations.

bruvellu commented 1 month ago

Almost finished the website strings on 461a6abfb64f5728616739a3432317bb6c6c0ab4. Most of the remaining strings are media titles and captions.