Thanks for trying our plugin!
PHP constants shouldn’t cause any problems with translations. Are you sure that this problem is not caused by something else?
Also, you can always use the official WordPress translation interface here: https://translate.wordpress.org/projects/wp-plugins/customer-reviews-woocommerce/ (this is the preferred way of translating plugins).
Hi,
PHP constants cause problems with translations. It is simply doesn’t work with Loco translate or WPML, because this plugins parse source files to find strings for translations from function s _e() __() etc. Strings with a text domain defined by constant or variable are ignored.
Please see official documentation:
https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#basic-strings
Thanks for providing additional information!
We have never tested “Loco translate” but WPML translations work fine (I know that a lot of people are using our plugin with WPML). Also, the standard WordPress translation tool doesn’t have any problems with constants: https://translate.wordpress.org/projects/wp-plugins/customer-reviews-woocommerce/
Can you please double check that the constant is actually causing issues with “Loco translate”?
Hi,
WPML doesn’t work for me, e.g. for this string:
22:/customer-reviews-woocommerce/templates/reviews-slider.php
<?php printf( _x( '%s ago', '%s = human-readable time difference', IVOLE_TEXT_DOMAIN ), human_time_diff( mysql2date( 'U', $review->comment_date, true ), current_time( 'timestamp' ) ) ); ?>
I sent you link to the official documentation and here is another resource:
https://pascalbirchler.com/text-domain-wordpress-internationalization/
Follow official approach in case of text domain, pretty please.
I did a screencast to prove, that translation is not working at my website.
VIDEO
This reply was modified 5 years, 4 months ago by ludekcerny .
Thanks for providing the video!
Can you please update the plugin to the latest version (3.127) and check if it resolves the problem with translations?
Cool, the last update solved the issue.
Hope this achievement encourage you to stop using constants as a text domain 😇 😉
Thank you!
Thanks for checking!
Please also consider translating the plugin with the official WordPress tools: https://translate.wordpress.org/projects/wp-plugins/customer-reviews-woocommerce/stable/cs/default/ instead of using third-party plugins as a workaround.