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

Unify install_t10ns() and update_t10ns() methods #4

Closed tyrann0us closed 6 years ago

tyrann0us commented 6 years ago

install_t10ns() and update_t10ns() have almost identical function bodies. IMO they should be merged in one method (with a conditional check what hook the method is currently added to). This would allow users to add the same function call to both the install and update hook, or use a referenced script like it's used in WP Starter's composer.json.

pelmered commented 6 years ago

Yes, this is a good idea. I noticed same when I read the code, but I didn't want to change the API at that time. But now I agree. It would be much better with a single method. I guess you can check what event you are on with the PackageEvent object, but I haven't done any research about that.

A referenced script is a great idea.

pelmered commented 6 years ago

This is now implemented.