mayukojpn / force-update-translations

Download WordPress theme/plugin translations and apply them to your site manually even their language pack haven't been released or reviewed on translate.wordpress.org
https://wordpress.org/plugins/force-update-translations/
12 stars 6 forks source link

Add Themes support #15

Closed pedro-mendonca closed 4 years ago

pedro-mendonca commented 6 years ago

The Update translation link might be added to the network themes list - hooked in theme_action_links.

For single site I didn't found any other action links hook, also can't think of a good place to insert the link, other than the theme details page.

Dartui commented 6 years ago

What you think about this? AFAIK this is the best what we can do. There are no actions nor filters to modify JavaScript templates which are used on themes page.

To achieve this I used wp_prepare_themes_for_js and modified description parameter. Something like this:

add_filter('wp_prepare_themes_for_js', function ($themes) {
    foreach ($themes as &$theme) {
        // we need to close description paragraph
        $theme['description'] .= '</p>';
        // we can omit closing paragraph tag
        $theme['description'] .= '<p class="theme-update-translation"><a href="#">Update translation</a>';
    }

    return $themes;
});

obraz

mayukojpn commented 6 years ago

@Dartui I'm sorry for delay to check! And thank you for suggesting code ❤️❤️❤️

Can you send me a pull request if I make add-theme-support branch? Then I'll add a generated link to GlotPress :)

Update: I added a branch 😉 https://github.com/mayukojpn/force-update-translations/tree/add-theme-support

pedro-mendonca commented 5 years ago

I've opened a ticket in core to add a few useful hooks on themes.php page. https://core.trac.wordpress.org/ticket/47650

imagem

If accepted, will allow to add action buttons and aditional info on the theme details panel.

If it's not accepted, than we can do the way @Dartui suggested above to include some more <p> in the theme description.