This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is working on a site under development and is trying to use translation hints in their code. However, they do not see the hint in the translation dialog when using the following PHP code:
printf(esc_html(// translators: %s is a year __( 'Active since %s', 'cnmd' ),), esc_html( $year ));
Solution:
The solution in this case would be using the _x() Function which will allow you to add a context to a sting. WPML String Translation does have a column to display this context.
Source: https://developer.wordpress.org/reference/functions/_x/
We further explained that the comment
/* translators: %s: %s is a year */
is intended to provide context to translators who are translating the theme or plugin into different languages. It helps in understanding what the string represents, especially when creating .po language files that accompany the theme or plugin. However, PHP comments, whether single-line (//) or multi-line (/* */), are ignored by the PHP interpreter during script execution. They are meant only for documentation and do not appear on the website or affect the program's execution. For more details on PHP comments, you can visit https://www.w3schools.com/php/php_comments.asp.
If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Should you need further assistance, please open a new support ticket with us.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 2 replies, has 2 voices.
Last updated by 4 months, 3 weeks ago.
Assisted by: Andreas W..