• Resolved siaevacom

    (@siaevacom)


    I would like to have translated text on the button for the different language areas of my site.

    I am currently using this code in my page template: <?php echo create_save_as_pdf_pdfcrowd_button('A4','Save as PDF'); ?>

    I already have a custom field that I can use so the correct translation appears when you’re on a different language page: <?php the_field('save_as_pdf_button_text'); ?>

    I just need to integrate the custom field with the button somehow. Right now it is controlled by the text that is set as ‘Button text’ in the plugin settings.

    • This topic was modified 4 years, 2 months ago by siaevacom.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter siaevacom

    (@siaevacom)

    Ahh fixed it. please ignore ??

    Plugin Author Pdfcrowd Dev Team

    (@pdfcrowd)

    The WordPress standard localization method “__()” can be used. E.g.

    
    <?php echo create_save_as_pdf_pdfcrowd_button(array('button_text'=>__('Save as PDF'))); ?>
    

    Your translation string should be located in WordPress “mo” file.

    Thread Starter siaevacom

    (@siaevacom)

    I’m trying to open the .pot file in Poedit (plugins > save-as-pdf-by-pdfcrowd > Languages > save-as-pdf-pdfcrowd.pot) but it says the file is either corrupt or in an unrecognisable format. It’s zero bytes. Not sure what to do…

    Plugin Author Pdfcrowd Dev Team

    (@pdfcrowd)

    Try to add your translation to the global mo file. It should be located in wordpress/wp-content/languages/

    Plugin Author Pdfcrowd Dev Team

    (@pdfcrowd)

    The plugin version 1.11.0 has a new option “Button Text Translation” on the Appearance tab. If it’s used, there is no need to call translate function in your code. So it should be enough to have your custom translation in po/mo file and just use:

    <?php echo create_save_as_pdf_pdfcrowd_button(); ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PDF Button for multilingual site’ is closed to new replies.