MainWP Community

Pro Reports PDF translation

Hi,

I was wondering if someone knows how you can translate the fields in the generated PDF. I mean the fields like ‘Plugins Updates’ and ‘Themes Updates’. Also the fields in the tables (Updated on:, etc)
I can’t find nothing about this in the documentation of Pro Reports.
I made my own template bases on the pro-reports-modern one.

Are there language files for this? I looked in the plugin folder under translation, but there is only an empty index.php there.

I hope someone can help me so I can translate my PDF file the correct way.

Reg.

Hi @webdesignIW, have you tried to make a custom template and rewrite text strings in wanted language?

To add onto what @bogdan has suggested - I have already did a search for how to “Rewrite Test Strings” the WordPress Way.

Simply add this code to your custom template.
https://wp-mix.com/replace-all-instances-string-wordpress

1 Like

Thanks for replying.

I used this code in my custom template and replaced the strings, but it’s not working. Or am I missing something?
This is what I have now:

function replace_text($text) {
	$text = str_replace('WordPress Version', 'WordPress Versie', $text);
	$text = str_replace('Active Theme', 'Actieve Thema', $text);
	return $text;
}
add_filter('the_content', 'replace_text');

Can you try to add a high number like 99 to the third argument of the add_filter

add_filter('the_content', 'replace_text', 99);

I did, but it’s nog working (also tried 999 as a higher number)
Maybe it’s only possible by rewrite the strings directly in my template.

I was just wondering how you can translate the PDF the way it’s supposed to be translated. (the proper way).

Yes that’s where I thought you were putting the code. That site is just an example. If the “wp way” doesn’t work then you will need to attack it with straight PHP: https://www.w3schools.com/php/func_string_str_replace.asp

1 Like

My scripting knowledge is limited. Can you help me how to do this?

For example in the template it says:

<th><?php echo __( 'General Information', 'mainwp-pro-reports-extension' ); ?></th>

How to translate this with PHP code?

This is what I have put in my code:

<?php
echo str_replace("General Information","Algemene informatie","mainwp-pro-reports-extension");
?>

But it’s not translating anything. What’s the strings name?

If you are just trying to display the string “General Information” in another language simply replace it.

<th><?php echo __( 'Algemene informatie, 'mainwp-pro-reports-extension' ); ?></th>
1 Like

I did. Tnx for helping.

1 Like

Is everything ok now?

Has your issue been addressed and fixed or do you still require our assistance?

Many thanx, issue fixed with your comment

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.