Support » Plugin: Colissimo Delivery Integration » How translate the CDI Shipping title seen by the customer ?

  • Resolved bguillemet

    (@bguillemet)


    Hi,
    I am using WPML for the translation of my site FR/EN.
    I do not see how I can translate the title/name of each of CDI lines.

    for exemple : Free Shipping (EN) > Livraison gratuite (FR).

    Any suggestions ?

    Regards
    Bruno

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Halyra

    (@harasse)

    Hello. You can translate these text strings (which are dynamically created texts, gettext compatible) either by the string translation tools of your translation plugin, or directly using the gettext filter.

    Possible alternative: make css modifications on the page.

    Bonjour. Vous pouvez traduire ces chaînes de texte (qui sont des textes créés dynamiquement, compatibles gettext) soit par les outils de traduction de chaîne de votre plugin de traduction, soit directement en utilisant le filtre gettext.

    Alternative possible : faire des modifications css sur la page.

    Thread Starter bguillemet

    (@bguillemet)

    Hi,
    thanks for your answer.

    Nevertheless, the “title shipping name” (colissimo_shippingzone_method_tablerate[0][method_name]) is not displayed in the String Translation Tool of WPML.

    For the getext filter method, I am not used to : could you provide a basic example ?

    Regards,
    Bruno

    Plugin Author Halyra

    (@harasse)

    Hi, Adapt this example filter according to your situation :

    
      add_filter( 'gettext', 'cdi_correction_traduction', 10, 3 );
      function cdi_correction_traduction( $translated_text, $text, $domain ) {
        if (get_locale() == 'fr_FR') {
          switch ( $translated_text ) { 
            case 'Colissimo' :
              $translated_text = 'Colis Poste Française : ';
              break;
            case 'Domicile sans signature' :
              $translated_text = 'Dépôt en boite aux lettres' ;
              break;
            case 'Free Shipping' :
              $translated_text = 'Livraison gratuite' ;
              break;
          }
        }
        return $translated_text;
      }
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How translate the CDI Shipping title seen by the customer ?’ is closed to new replies.