pontoon
pontoon copied to clipboard
Allow reading configuration from the repository
Fixes #2545
I have no idea how to write tests for this as I'm not a Python developer :slightly_smiling_face:
Thanks for the patch @Demivan!
Sorry for the delay in the review process. We're on a work week this week. We'll have a look ASAP.
@eemeli @mathjazz Sorry for pinging. Is there anything I need to improve to have this merged?
@eemeli @mathjazz Sorry for pinging. Is there anything I need to improve to have this merged?
Putting this to my TODO list. Sorry it's taking so long.
Thanks. I have updated branch with latest fix from master
Hi @Demivan!
I am very sorry for how long it took to take a look at your patch. There really are no excuses for this.
The code looks good (a unit test would be nice 😊). I also tested the patch with our projects that use l10n.toml file and didn't spot any issues. Great work!
Downloading files will not work for projects that don't set "Download prefix or path to TOML file". Are you OK with that? We should file an issue for that before merging this patch, so we don't forget about it.
@mathjazz Thanks for reviewing the pull request.
Downloading files will not work for projects that don't set "Download prefix or path to TOML file"
All my projects have TOML configuration file, so this is not an issue for me personally. But that is a much bigger change and depends on how Pontoon wants to handle repositories without the config. Probably some kind of default configuration can be generated in that case.
To clarify - the Repositoy.permalink_prefix field, which shows up as "Download prefix or path to TOML file" in the Project Admin, must be set for downloads to work.
My understanding was that your projects are in private repos, so with this patch applied, you would leave that field empty in and take the TOML file directly from the repository. Is that not the case?
Yes. I leave "Download prefix or path to TOML file" field empty but I set "Configuration file (optional)" and Pontoon now reads config and strings directly from the repository.
Right. And the "Download Translations" option (available from the profile menu in the translate view) doesn't work (i.e. you get an error page)?
Yes, it fails. But I have never actually used it :)
Looks like support for reading everything from the repository needs even more changes than I thought. But this fix is enough for me. I don't know why Pontoon does not read from the repository by default. And I think it would be a good idea to support this use case properly at some point.