Automatic Variants for GlotPress

Automatic Variants for GlotPress Install Statistics

0
100%
Today: 0 Yesterday: 0 All-time: 608 downloads
Automatic Variants for GlotPress Icon

Try plugin: Automatic Variants for GlotPress

We'll create fresh WordPress site with Automatic Variants for GlotPress installed. You have 20 minutes to test the plugin after that site we'll be deleted.

Takes ~10 seconds to install.

About Automatic Variants for GlotPress

Plugin for GlotPress to manage automatically converted variants.

0


0


0


0


0

updated: 2 years ago
since: 3 years ago

Description

This plugin for GlotPress customizes the default behavior of a set of chosen pairs of Locales (root/variant), allowing you to automatically convert the approved/current strings in the root to its variant.

It keeps the root translations automatically converted and synced with its variant translations within your GlotPress install.

The only translations added to the variant translation set are those which are different from the root translation.

The strings that don’t need any conversion remain untranslated on the variant, falling back to the root Locale.

This plugin was heavily inspired by the Serbian Latin solution for transliteration of Serbian Cyrillic locale from translate.wordpress.org.

Features

  • Filter gp_automatic_variants_list to add your variant to the array of automatically converted variants.
  • Filter gp_automatic_variants_convert_{variant_locale} to process the conversion of strings of the automatic variant.
  • Check for GlotPress minimum requirements.
  • Check if the added Locales are variants supported the installed GlotPress.
  • Convert current root translations and add to the variant translation set.
  • Delete variant unused translations instead of keeping as rejected, fuzzy, old.
  • Delete current variant translation if a new root translation (same original_id) is added and doesn’t need conversion.

Install GlotPress

  1. Install and activate GlotPress 3.0.0-alpha minimum version.

  2. Install and activate this plugin from your plugins page.

Configure Automatic Variants for GlotPress

  1. Set the variants you want to be automatically converted with the filter gp_automatic_variants_list:

    /**
     * Add my automatically converted variants.
     */
    function my_automatic_variants( $locales ) {
        $additional_locales = array(
            'ca-valencia',
            'pt-ao90',
            'ca-valencia',
            'en-gb',
            'de-at',
            'de-ch',
        );
        return array_merge( $locales, $additional_locales );
    }
    
    add_filter( 'gp_automatic_variants_list', 'my_automatic_variants' );
    
  2. Add your Locale actual conversion process with the filter gp_automatic_variants_convert_{variant_locale}:

    Example for the variant ‘pt-ao90’:

    /**
     * Actual conversion of the string.
     */
    function convert_translation( $translation ) {
        return do_something( $translation );
    }
    
    add_filter( 'gp_automatic_variants_convert_pt-ao90', 'convert_translation' );
    

    Usage

  3. For every translation project, add both root and variant translation sets as usual.

  4. Translate only on the root Locale and see the conversions automatically propagate to the variant.

Requirements