Here are several possible solutions for your issue. Before applying them, we strongly recommend creating backups of your site’s files and database.
- 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:
- Navigate to WPML > String Translation.
- At the bottom of the page, click Translate texts in admin screens.
- Search for your button label in the plugin’s settings.
- Mark it for translation and return to the String Translation section.
- 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.