Following up on this:
@ByteHamster, I’d like to get your advice/opinion.
Netlify’s Deply Preview integration is so simple, that it’s just a matter of clicking some buttons - but this also means there’s no GitHub action that we can adjust. I see a few options to still get Netlify Deploy previews for new languages:
- Set up a GitHub action that we can manually trigger, for which case you have to select a branch. The branch you select would be the one of the PR that adds a language to the config file. The trigger checks in 1] the the config file of the PR from the selected branch (where the extra languages are added), 2] all other files from the master branch (which has the relevant site files), and 3] the translation files from the translations branch. From this mix, it creates the relevant localised files. It them commits them to the master branch. We then can trigger a re-test for the PR, and Netlify can build the deploy preview with the language added in the PR.
- Making it slightly more advanced, we could automate this - and have this action run automatically when the config file is changed in a PR. We build in an extra step in the beginning: If the list of languages changed in that PR compared to master, the rest executed. If the list is not changed, the action exits with success without doing anything. This would allow anyone to create files in the _i18n folder by creating a PR that adds a language, but that’s a limited risk (as we manually pull translations from Weblate, and this action won’t make the translations available on the live website.
- Kind of the same idea as above, but instead of committing the localised files to master, a new PR (PR2) is opened automatically with the same mix mentioned above, triggering a deploy preview being built by Netlify that contains both the updated config as well as the localised files, therefore generating a usable deploy preview.
- Alternatively, instead of creating a new PR, create a new branch and trigger a branch build via a Netlify build hook - not sure this would work.
- Kind of the same idea as above, but instead of committing the localised files directly to master, just commit to the PR branch. That should trigger an updated Netlify deploy, so it can be reviewed. The PR can then be merged including the localised files (which is normally the task of the
translation-updates-to-main-repoaction). However, this PR might then be outdated already when it is merged, as by the time the translations have been reviewed, corrections will be waiting in Weblate (or even in the translations branch).