Support » Plugin: Theme and plugin translation for Polylang (TTfP) » Translate custom shipping zone

  • Resolved samvel45

    (@samvel45)


    Hi WP bros. I gotta one problem here.I added this zones with this code and i need to translate that zones`

    /**
     * Add or modify States
     */
    add_filter( 'woocommerce_states', 'custom_woocommerce_states' );
    
    function custom_woocommerce_states( $states ) {
    
      $states['AM'] = array(
        'AM1' => 'Yerevan', 
        'AM2' => 'Regions & Artsakh'
      );
    
      return $states;
    }

    Any variants?Thanks.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter samvel45

    (@samvel45)

    and of course if its possible i want to translate shipping methods.Thanks again

    Plugin Author marcinkazmierski

    (@marcinkazmierski)

    Hi,
    try to use function __():

      $states['AM'] = array(
        'AM1' => __('Yerevan'), 
        'AM2' => __('Regions & Artsakh')
      );
    
    Thread Starter samvel45

    (@samvel45)

    Thank you much.I’ll try and come back soon.

    Thread Starter samvel45

    (@samvel45)

    According to your advice i made changes but strings still dont detect them.Maybe you can tell me something another.Thank you

    Plugin Author marcinkazmierski

    (@marcinkazmierski)

    this is strange,
    you have plugin with this texts enabled in your admin panel:
    /wp-admin/admin.php?page=mlang_import_export_strings
    ?

    where exactly is custom_woocommerce_states function located ?
    where is this file?

    Thread Starter samvel45

    (@samvel45)

    Thanks for reply
    Ive ade them as In custom Snippets plugin so i think they are located there

    Thread Starter samvel45

    (@samvel45)

    And if its dont hard for you what you can sa about translation of shipping methods,thank you a ton

    Thread Starter samvel45

    (@samvel45)

    /**
    * Add or modify States
    */
    add_filter( ‘woocommerce_states’, ‘custom_woocommerce_states’ );

    function custom_woocommerce_states( $states ) {

    $states[‘AM’] = array(
    ‘AM1’ => pll__(‘Yerevan’),
    ‘AM2’ => pll__(‘Regions & Artsakh’)
    );

    return $states;
    }

    echo pll__(‘Yerevan’);
    echo pll__(‘Regions & Artsakh’);

    maybe this can help?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Translate custom shipping zone’ is closed to new replies.