Patch lektor-i18n-plugin to fix having to build a site multiple times
I've had a patch to lektor-i18n-plugin sitting around half-done for around three months. I'm currently working on finishing it up, and I wanted to make an issue here just to let everyone know I'm working on it.
Progress:
-
patch the I18NPlugin
class-
turn all the necessary methods into class methods ( __parse_source_structure
,__trans_linewise
,__trans_parwise
) -
patch the rest of the class to call these -
move the on_before_build
method body to a newtranslate_contents
method, and haveon_before_build
call the new method
-
-
write an example script that can be run once to translate all the contents, without having to build the site -
document the changes and script -
send the patch upstream
These changes won't actually break any CI/scripts/workflows that build the site multiple times, and it will enable a much faster and simpler workflow of ./translate_contents && lektor build
Reasoning: Our CI time for lektor sites is the three lektor builds, with a small overhead for the job to get started. This patch would cut down CI time to about a third of what it is now, saving anywhere from 2 to 10 minutes for a job to run. I also find myself having to run a completely clean build from time to time, so this saves local dev time quickly iterating changes.