• Resolved hybridmedia

    (@hybridmedia)


    Hi,
    In my settings my button label is: Print this section.
    Now I use WPML to translate my website and I was wondering how I can translate this button label?
    I already pulled all strings inside the plugin but it wasn’t there.
    Can you please help me.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support andrewsupport

    (@andrewsupport)

    Here are several possible solutions for your issue. Before applying them, we strongly recommend creating backups of your site’s files and database.

    1. Add the Button Label to the String Translation

    If the label “Print this section” isn’t appearing in the WPML string translation, you can register it manually:

    Edit the Plugin’s Settings:

    • Go to the WordPress admin panel and navigate to PDF & Print Settings.
    • Set the desired label for the button (e.g., “Print this section”).

    Scan the Plugin for New Strings:

    • Go to WPML > Theme and Plugins Localization.
    • Locate the PDF & Print plugin and click Scan to find new strings.

    Translate the String:

    • Go to WPML > String Translation.
    • Search for the button label (e.g., “Print this section”).
    • Add translations for each language, then save your changes.

    2. Use Custom Strings if Needed

    If the string doesn’t appear after scanning:

    1. Navigate to WPML > String Translation.
    2. At the bottom of the page, click Translate texts in admin screens.
    3. Search for your button label in the plugin’s settings.
    4. Mark it for translation and return to the String Translation section.
    5. Translate it as needed.

    3. Modify with WPML’s gettext Hook(Advanced)

    If the above methods don’t work, you can use WPML’s gettext filter to manually translate the label. Add this code to your theme’s functions.php file:

    php

    Copy code

    add_filter( 'gettext', 'custom_translate_print_button', 10, 3 ); function custom_translate_print_button( $translated_text, $text, $domain ) { if ( 'Print this section' === $text && 'pdf-print' === $domain ) { if ( ICL_LANGUAGE_CODE === 'fr' ) { // Replace 'fr' with the WPML language code. $translated_text = 'Imprimer cette section'; } elseif ( ICL_LANGUAGE_CODE === 'es' ) { // Replace 'es' with another WPML language code. $translated_text = 'Imprimir esta sección'; } } return $translated_text; }

    Replace the translations (Imprimer cette section, Imprimir esta sección) with the desired labels for your languages.

    If none of the materials above help, please continue this discussion, and we will try to assist you further. The link you mentioned where help was needed is restricted from viewing.

      Thread Starter hybridmedia

      (@hybridmedia)

      Hi,

      I already did: Add the Button Label to the String Translation
      But after locating the plugin and scan for new strings, I go to string translations and ‘Print this section’ is nowhere to be found.
      But the ‘use custom strings if needed’ worked perfect! Thank you

    Viewing 2 replies - 1 through 2 (of 2 total)
    • You must be logged in to reply to this topic.