Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 5 replies, has 3 voices.

Last updated by paulp-16 4 months, 1 week ago.

Assigned support staff: Rohan Sadanandan.

Author Posts
July 5, 2019 at 11:14 am #4150543

paulp-16

We needed different pages per category so we have created one template per each category.
Named like this: taxonomy-product_cat_namecategory.php
How can I create different string on this page(s) so they can be translated

July 5, 2019 at 2:14 pm #4152005

Rohan Sadanandan
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello,

Thank you for contacting WPML Support.

Do you want to translate the strings inside the template code?
If so, you can use String Translation.
You can read more about String Translation here:
https://wpml.org/documentation/getting-started-guide/string-translation/

Also please make sure that your template is following WordPress internalization standards.
Then only WPML can pick it for translation. You can read more here: https://codex.wordpress.org/I18n_for_WordPress_Developers

If this is not what you are asking then please let me know what you are trying to achieve with a screenshot or a link.

Thanks,
Rohan

July 8, 2019 at 11:29 am #4161909

paulp-16

The template code is the following:
-------------------------------------

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}

echo '<div class="category-header c-mill-oil"><div class="c-h-text"><h1>DSILL OIL</h1><br><p class="sub">Oil filled radiators have never looked so beautiful.</p></div></div>';

wc_get_template( 'archive-product.php' );

-----------------------
We would like to have the text between <h1> and <p> as translatble strings.

July 8, 2019 at 2:22 pm #4163481

Rohan Sadanandan
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello,

As I have mentioned, you should follow the WordPress internalization standards as mentioned in https://codex.wordpress.org/I18n_for_WordPress_Developers

In your case, you need to use the _e() function.

See the below standardized code. You need to replace the 'your-text-domain' with your text domain name.

<div class="category-header c-mill-oil">
<div class="c-h-text">
<h1><?php _e( 'DSILL OIL', 'your-text-domain' ); ?></h1>
<br>
<p class="sub"><?php _e( 'Oil filled radiators have never looked so beautiful.', 'your-text-domain' );?></p>
</div>
</div>

Thanks,
Rohan

July 8, 2019 at 2:59 pm #4163755

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi, It is just to change the status of this ticket.

July 9, 2019 at 9:58 am #4169405

paulp-16

My issue is resolved now. Thank you!