X overriding WooCommerce Translations

I have added the required files for translating the site but some part of the site isn’t translated because of the way X is built. It should pick up 100% of the text from WooCommerce translation files. But it doesn’t. This issue was raised a long ago, but currently working on a site doesn’t seem it is fixed. Is it?

Hi,

Thanks for writing in!

Can you provide us your site url and specify the parts of your site that isn’t translated. Maybe it’s part of X theme.
Please also provide the list of files that you have added to your child theme.

For the mean time kindly review the link below.

Thanks

This isn’t the solution to the problem. I am saying why doesn’t it with outside the box like most other themes?

Hi,

The theme is designed so you can do all translation in one place.

If we allow woocommerce translation there will be 2 places to translate which is not ideal and could create conflicts.

Please refer to the link below for more information

Thanks

but that’s just more work. Why do we want manual translations when it is already translated?

Hey @faizan,

The WooCommerce template files that X overrides must be translated through the __x__ Text Domain. Because X does not override all of WooCommerce template files, you will need to translate the rest through WooCommerce’s text domain. With that said, you should translate WooCommerce separately. Here’s the instruction.

@paul.r asked previously what texts are not translated because there could be a bug in X that we are not aware of. We need to check if the texts use X’s text domain or WooCommerce’s text domain.

Thanks.

//Translation 
add_filter('gettext', 'x_translate_text' , 20, 3);
function x_translate_text ( $translated_text, $text, $domain ) {

$translation = array (
'Apply Coupon' => 'Appliquer un bon de réduction','Name' => 'Nom', 'Related products' => 'Vous aimerez aussi…', 'Apply Coupon' => 'Appliquer un bon de réduction', 'Reviews' => 'Avis', 'There are no reviews yet.' => "Il n'y a pas encore d’avis", 'Be the First to Review' => "Soyez le premier à laisser un avis", 'Submit review' => 'Postez un avis', 'price range' => 'échelle des prix', 'Reset' => 'Réinitialiser', 'No More Items for the Selected Filter' => "Plus d'éléments pour le filtre sélectionné"
);

if( isset( $translation[$text] ) ) {
return $translation[$text];
}

return $translated_text;

}

I have translated using the above snippet.

Hi faizan,

I checked these strings and I can confirm they are related to X theme files so they must be translated within the X theme as you did or by using POEditor as mentioned in the translation help doc mentioned above.

Thanks.

So everyone has to translate them again and again and can’t use Woo translation?

Hi faizan,

As these strings are in the modified files of WooCoomerce in X theme, then they must be translated via X theme with any of the methods mentioned in the translation documentation which was previously mentioned on this thread.

I’m not sure I can fully understand your question, for specific I’m not sure what do you mean by “everyone”? actually, once you have translated these strings by that way you mentioned and added the code into child theme functions.php file, no one is required to translate them again and again, it’s just one time only. Please make sure you are using a child theme to avoid losing these codes after any theme update:

Thanks.

What I’m saying is suppose if I have translated the stuff to French.
Now some random theme user wants to use French WooCommerce. Will he have to translate this again? He won’t be able to use my translated stuff without knowing me?
Likw WooCommerce translation has been done by contributors for so many languages, this won’t happen with X right?

Hi there,

Do you mean there are multiple translators/authors? If the content is specific to them then yes, they should translate it themselves. Though, with woocommerce template and strings, then don’t have to if it’s already translated. They only need to translate newly added content like product description and such.

Thanks!

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