i18n: Italian translation
Hello, I work for GARR, the italian network for research and education, and we are starting to use this tool internally with the aim of deploying this as a service for our community. To do so I already built and translated the .po file as described in #247 and have it working on our instance, so we would like to contribute to the project with that.
Also, we would like to have the mail templates translated but right now lingui is not configured to do so and I don't know what the best aproach would be as I know python but i'm not familiar with flask or javascrip, so any guidance would be helpful.
Many thanks for your work!
Hi @lucvin! Great to hear that other organizations are using Newdle as well!
I opened https://github.com/indico/newdle/pull/504 to add the Italian locale. Once it's merged, you can open a PR adding your translated PO file :) (edit: merged, feel free to send a PR with your translations!)
Also, we would like to have the mail templates translated but right now lingui is not configured to do so [...]
From my quick reading of the lingui docs, it can only extract from js/ts files. We would most likely need to use babel to extract messages from html and txt files. Would you like to help with that?
For starters, we can focus on just making extraction work. For that, you'd basically need to add babel as a dependency to our requirements file and add some simple babel config similar to what we have in Indico.
Hi, i also found a couple of missing translation tags and added them to the pr, hope it's ok. I will try and see if I can extract the mail messages with babel as you suggested.
Also i wasn't able to translate the month and weekday strings as those are not extracted by lingui, any way to translate them?
(There is also an hardcoded lock on the locale picker right now, i removed it on our instance but i figured it was outside the scope of this pr, maybe after i can translate the mail tamplates)
Thanks
i also found a couple of missing translation tags and added them to the pr, hope it's ok.
Absolutely! Let us know if you find more!
I will try and see if I can extract the mail messages with babel as you suggested.
Let me know if you need help with anything!
Also i wasn't able to translate the month and weekday strings as those are not extracted by lingui, any way to translate them?
You mean in the calendar? That is provided by an external library, but there should be a way to do that. I can look into that.
(There is also an hardcoded lock on the locale picker right now, i removed it on our instance but i figured it was outside the scope of this pr, maybe after i can translate the mail tamplates)
We can remove it in a follow up PR :)
(There is also an hardcoded lock on the locale picker right now, i removed it on our instance but i figured it was outside the scope of this pr, maybe after i can translate the mail tamplates)
I opened a PR that enables it again: https://github.com/indico/newdle/pull/506
I copied the config snippet with .html and .txt from Indico, added the {% trans %}/{% endtrans %} tags to the text in the html and txt templates and got extraction working. I guess the next steps are deciding where to put the config file and the message catalogs and then adding the command in the make file, right? What else?
You mean in the calendar? That is provided by an external library, but there should be a way to do that. I can look into that.
Yes, thank you, but also whenever a timeslot is shown with the date if it's not the same library.
I opened a PR that enables it again: https://github.com/indico/newdle/pull/506
Thanks! :)
I guess the next steps are deciding where to put the config file and the message catalogs and then adding the command in the make file, right? What else?
Maybe under newdle/translations? For the first part, this should be good enough, feel free to open a PR if you already have something :)
Then we'll need to figure out how the language of an email is decided. For example when you create a newdle and invitation emails are sent, what language should the email be? We currently don't track language preferences for users (newdle doesn't really have users per se, each newdle has participants which just have a name and email).
There are options such as setting the language for each newdle or even have a global config for the whole newdle instance. Anyway, we don't need this for the initial babel setup but it's just something to think about.
I've seen the translation is now handled by weblate, should I contribute there with my translation? the file i provided got overridden
We actually had weblate all along, it was just kind of forgotten and we never set up the workflows to pull/update translations. We merged your translations with what was already on weblate. Now that we can pull from weblate, I think it makes sense to contribute translations there :)
Hello, now the italian translation on weblate is complete, how is it pulled in the repo?
As of #509 it's trowing an error because jinja doesn't recognize the {% trans %} tags out of the box and I don't know how to fix that without going for trial and error, any help? :)
Hello, now the italian translation on weblate is complete, how is it pulled in the repo?
There is some (semi)-automated workflow where weblate periodically pushes new messages to the repo. @ThiefMaster spent some time figuring it out so he'll know better.
it's trowing an error because jinja doesn't recognize the {% trans %} tags
You need to enable the extension, something like
app.jinja_env.add_extension('jinja2.ext.i18n')
where app is the flask app, should work. More info: https://jinja.palletsprojects.com/en/stable/extensions/#i18n-extension