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

Support stable. #16

Open mekemoke opened 6 years ago

mekemoke commented 6 years ago

Imported file only had 30 strings. Not sure about order of strings.

Plugin: Customize Snapshots (Beta Plugin) Locale: ja

mekemoke commented 6 years ago

Problem: Translation was put on stable Recommended Fix: import translation files from stable to dev.

force-update-translations.php 145

function get_source_path( $project, $locale, $format = 'mo', $type = 'dev' ) {
        $locale = GP_Locales::by_field( 'wp_locale', $locale );
        $path = sprintf( 'https://translate.wordpress.org/projects/%1$s/%2$s/%3$s/default/export-translations?filters[status]=current_or_waiting_or_fuzzy',
            $project,
            $type,
            $locale->slug
        );
        $path = ( $format == 'po' ) ? $path : $path . '&format=' . $format;
        $path = esc_url_raw( $path );
        return $path;
    }

ここで $type に dev を渡されていて、変更する手段がないのが原因でした。

pedro-mendonca commented 6 years ago

Some repos only have stable and some only dev. Would it make sense to have both links? Example: Update translations dev | stable The above suggestion was inspired on the plugin GP Import Translations from wordress.org that adds both links on the bottom of the translation tables.

Or will it make sense to try first to get from stable and if error returned, try getting from dev, keeping a single action link as currently?

ePascalC commented 4 years ago

If you put both dev and stable as choices, then you probably need to check for the existence before showing both options. I would keep only 1 possible option, try to load dev and if nothing found, try to load stable

pedro-mendonca commented 4 years ago

I agree with @ePascalC