Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 7 replies, has 2 voices.

Last updated by Marcos Vinicios Barreto 3 months, 3 weeks ago.

Assigned support staff: Marcos Vinicios Barreto.

Author Posts
September 27, 2021 at 2:17 pm

Raphael Cavalieri

I am currently experiencing a problem, a character string does not appear at all in the translation strings despite the analysis of all the themes, plugins of the site. The following string is not found for translation.

Escompte pour règlement anticipé de 0% - Pénalité en cas de retard de paiement: 10% du montant et 40 €
d’indemnité forfaitaire pour frais de recouvrement (loi n°2012-387 du 22 mars 2012 en vigueur depuis le
1er janvier 2013).

September 27, 2021 at 3:12 pm
September 28, 2021 at 6:13 pm #9680597

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for contacting our support service. I took a detailed look at your WordPress Dashboard, reviewed the template code for the woocommerce-pdf-invoices-packing-slips plugin, however it still not clear to me where this text come from. I also, didn't find it in anywhere from plugin settings or even WooCommerce settings, so, here I would appreciate to know some details to understand how this text is setup, if it is something bultin in plugin files, for example template files and so on.

Can you please, let me know? Maybe you can get these details from the plugin author itself. Once I have these details, I will proceed with another look in order to determine if it is something translatable with WPML or not.

Thank you for your collaboration and continued patience, have a nice day.

September 29, 2021 at 8:28 am #9684103

Raphael Cavalieri

Hello,

The problem is that I don't know where this string comes from, hence the fact that it is not available in the translation.
Do you have the contact of the person who created the plugin please because I did not find it

Thanks

September 29, 2021 at 4:02 pm #9688629

Raphael Cavalieri

Hello,

I know where the string comes from, it comes from the functions.php file, but despite the fact that I scan the child theme the string does not appear.

September 29, 2021 at 11:40 pm #9690721

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the clarifications. Browsing your child theme functions.php file, I see this snippet of code:

function custom_wp_new_user_notification_email( $wp_new_user_notification_email, $user, $blogname ) {
    if($user->roles[0]=="wholesale_buyer_notyet" || $user->roles[0]=="dropshipper_notyet"){

    global $wpdb;
    // Generate something random for a password reset key.
    $key = wp_generate_password( 20, false );
 
    /** This action is documented in wp-login.php */
    do_action( 'retrieve_password_key', $user->user_login, $key );
 
    // Now insert the key, hashed, into the DB.
    if ( empty( $wp_hasher ) ) {
        require_once ABSPATH . WPINC . '/class-phpass.php';
        $wp_hasher = new PasswordHash( 8, true );
    }
    $hashed = time() . ':' . $wp_hasher->HashPassword( $key );
    $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
 
    $switched_locale = switch_to_locale( get_user_locale( $user ) );
 
    /* translators: %s: user login */
   
         $wp_new_user_notification_email['subject'] = '[France Mineraux] Inscription à la vente en gros - Accès et Mot de passe';
        $nomprenom_array= explode(".",$user->user_login);
        $wp_new_user_notification_email['message'] = "

        
        Bonjour ".ucfirst($nomprenom_array[0])." ".ucfirst($nomprenom_array[1]).",
        <br><br>
        Nous avons bien reçu votre demande d'inscription et vous en remercions. Après vérification de vos informations dans les prochaines 24h, vous aurez accès directement à votre compte via votre nom d'utilisateur : <b>" ".$user->user_login." "</b>. Dans l'attente, nous vous invitons d'ores et déjà à réinitialiser votre mot de passe à l'adresse suivante : 
        <a href='".network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login')."'>".network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login')."</a><br>
        Si le lien de réinitialisation n'est pas clicable ou n'est pas fonctionnel, veuillez le copier-coller dans votre navigateur. Le problème devrait être résolu. Si le problème persiste, vous pouvez essayer de supprimer les cookies de navigation avant de copier-coller le lien.
        <br>
        Dorénavant, vous avez accès à nos tarifs professionnels qui seront automatiquement appliqués en bas de votre panier, sur le montant TOTAL en euros H.T : 
        <br><ul>
           <li> De 0 à 200 H.T : 20% de remise </li>
           <li> De 200 à 400 H.T : 30% de remise </li>
           <li> De 400 à 800 H.T : 40% de remise </li>
           <li> Au dessus de 800 H.T : 50% de remise</li></ul>
        Votre 1ère commande doit être de 250 euros H.T minimum. Suite à cela, vous n'aurez plus de montants minimum lors de vos prochaines commandes.
        <br>
        Si vous avez des questions, n'hésitez surtout pas à revenir vers nous. 
        <br><br>
        <b>Le Service Client France Minéraux</b>



        ";  
    }
    return $wp_new_user_notification_email;
    
    
}

This is a hard coded text in your theme files, not really WordPress localized and this way not possible for a multilingual plugin such as WPML to read and register it. You need to make sure the text is wrapped in gettext functions, then, you should be able to register it using WPML String Translation.

See:

https://wpml.org/documentation/support/achieving-wpml-compatibility-for-your-themes-and-plugins/#11

https://wpml.org/documentation/support/translating-the-theme-you-created/

https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

Hope it helps, have a nice day.

September 30, 2021 at 9:14 am #9693867

Raphael Cavalieri

My issue is resolved now. Thank you!

September 30, 2021 at 9:59 am #9694299

Raphael Cavalieri

Hello,

I would like to reactivate the ticket because I thought that my problem was solved but in fact not
When I add the function :
<?php __( 'Discount for early payment of 0% - Penalty in case of late payment: 10% of the amount and 40 € fixed compensation for collection costs (law n°2012-387 of 22 March 2012 in force since 1 January 2013) .', 'fm-traduction-newp' ); ?>
The element is translatable but it is always displayed on the invoice and the condition is no longer the right one, I don't know why.
I don't know why. For example, when I remove <?php __ it works well but is not available in the translations
Do you have an idea?

Here is the complete code:
add_action( 'wpo_wcpdf_after_order_details', 'blue_section_wholebuyers', 10, 2 );
function blue_section_wholebuyers ($template_type, $order) {
$user_id = $order->get_user_id();
if ( !empty($user_id) ) {
$meta_key = 'wp_capabilities'; // change this to your meta key / custom field name

// Get the user object.
$user = get_userdata( $user_id );

// Get all the user roles as an array.
$user_roles = $user->roles;

$custom_field = get_user_meta( $user_id, $meta_key, true );
?><?
if($user_roles[0]!="customer"){
?>
?><? if($user_roles[0]!="customer"){?
<?php __( 'Discount for early payment of 0% - Penalty in case of late payment: 10% of the amount and 40 € fixed compensation for collection costs (law n°2012-387 of 22 March 2012 in force since 1 January 2013) .', 'fm-translation-newp' ); ?>
</p>
<? } ?>
<?php
}
}

Thank you

September 30, 2021 at 6:03 pm #9698521

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. I am not really familiar with your customizations and unfortunately it is out of our support scope to fix your custom code (see https://wpml.org/purchase/support-policy/), however, I am still able to recommend you change the gettext __() function to esc_html_e() function, so it 'auto echo' the content instead of return it.

In case it still doesn't work, I recommend you to get some help for these customizations from one of our WPML contractors at: https://wpml.org/contractors/.

Thank you for your understanding, have a nice day.