pontoon icon indicating copy to clipboard operation
pontoon copied to clipboard

Allow reading configuration from the repository

Open Demivan opened this issue 3 years ago • 2 comments

Fixes #2545

I have no idea how to write tests for this as I'm not a Python developer :slightly_smiling_face:

Demivan avatar Jun 09 '22 08:06 Demivan

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.

mathjazz avatar Jun 15 '22 11:06 mathjazz

@eemeli @mathjazz Sorry for pinging. Is there anything I need to improve to have this merged?

Demivan avatar Jul 31 '22 11:07 Demivan

@eemeli @mathjazz Sorry for pinging. Is there anything I need to improve to have this merged?

Demivan avatar Oct 25 '22 15:10 Demivan

Putting this to my TODO list. Sorry it's taking so long.

mathjazz avatar Oct 25 '22 17:10 mathjazz

Thanks. I have updated branch with latest fix from master

Demivan avatar Oct 26 '22 06:10 Demivan

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 avatar Feb 15 '23 12:02 mathjazz

@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.

Demivan avatar Feb 15 '23 12:02 Demivan

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?

mathjazz avatar Feb 15 '23 13:02 mathjazz

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.

Demivan avatar Feb 15 '23 13:02 Demivan

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)?

mathjazz avatar Feb 15 '23 13:02 mathjazz

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.

Demivan avatar Feb 15 '23 13:02 Demivan