pelmered / composer-wp-language-updater

Automatically update the language files for core, plugins and themes after running install|update in composer.
6 stars 1 forks source link

Don't use Guzzle to download translations #8

Closed tyrann0us closed 2 years ago

tyrann0us commented 6 years ago

Recently, we had a lengthy internal discussion about a Composer based solution to get translations. The main reservation against this package (beside the fact that the code isn't really "clean") was that it uses Guzzle to download the translations:

The chances you get a dependencies conflict for something that is not even needed in production is very high. Ideally, building scripts should have no dependencies at all, but a such popular and big dependency like Guzzle is clearly a non-best practice.

― @gmazzap

An appropriate alternative is Composer's RemoteFilesystem class or even just file_get_contents() as in @bjornjohansen's wplang.

Maybe you want to follow https://github.com/wecodemore/wpstarter/issues/44, especially https://github.com/wecodemore/wpstarter/issues/44#issuecomment-412217148 as this covers all requirements of a Composer based translation download in a modern WordPress stack.

bjornjohansen commented 6 years ago

I ran into the same issue as several other projects have: That the autoloader wouldn’t pick up Guzzle’s function files.

Using RemoteFilesystem sounds like a good idea.

pelmered commented 6 years ago

Great writeup in the comment.

I agree that the code is quite messy in this package. I probably should've done a rewrite instead of refactoring on top of the original package.

With that in mind, wplang is probably a better starting point for creating something great that solves this problem. I can merge in some of the code from here to add the additional features I have added.

Maybe we should set up at video call to discuss this where we try to come up with a solutions for most of the problems mentioned in that comment and decide what we do from here? What do you think @tyrann0us @bjornjohansen? We could also invite some people from wpstarter.

tyrann0us commented 6 years ago

@pelmered, let's continue discussion in the WordPress Slack. There's already a conversation with @bjornjohansen and you that can be easily extended to include more people.

pelmered commented 6 years ago

Yes, great idea. I'll join you there @tyrann0us!