Home › Forums › WoodMart support forum › Problem with translations
Problem with translations
- This topic has 15 replies, 2 voices, and was last updated 5 months, 2 weeks ago by Hung Pham.
-
AuthorPosts
-
July 5, 2024 at 12:16 pm #581184
pablovilcParticipantHi
I have a problem with woocommerce domain translations rendering from the woodmart theme.
My site is in spanish, and all woodmart translations are working, but references to woocommerce strings like “__(‘test’, ‘woocommerce’)” are not loading.
When I change the theme to Default wordpress 24th all woocommerce translations are rendering without problems…
In short, when I activate woodmart, instances to other translation domains that do show up both in the wordpress panel and with other themes are not rendering correctly.
Thanks in advice
July 5, 2024 at 2:01 pm #581243
Hung PhamKeymasterHi pablovilc,
Thanks for reaching to us.
+ In order to change / translate words. Please make sure you synced the strings first before changing / translating WooCommerce, WoodMart Core plugins and WoodMart theme. You can refer to article https://xtemos.com/docs-topic/theme-translation/
+ You are also need to select the language for the backend and theme settings for admin from the admin user profile, please edit the user’s profile and then select the language for that user it will show the same on the backend.
Regards,
July 5, 2024 at 5:08 pm #581338
pablovilcParticipantHello Hung,
Thanks for the answer, but I don’t think I have explained myself well….
Both the website and the users have correctly assigned the Spanish language and all the translation files are correctly uploaded, in the wordpress backend all the strings are in Spanish and, if I activate the Twenty Twenty-Four theme the strings in the frontend are correctly displayed in Spanish (I attach a screenshot of the cart page so you can check it, img1).
However, when I activate woodmart, the strings that belong to the woocommerce domain (such as “Your cart is currently empty.”) which is translated with any other theme, are not translated (img2). Only the strings that appear in the code under the domain ‘woodmart’ are being translated.
In other words, the problem only appears when Woodmart is activated.
Thanks in advance
Attachments:
You must be logged in to view attached files.July 6, 2024 at 9:34 am #581427
Hung PhamKeymasterHi pablovilc,
To assist you in the best possible manner, I kindly ask that you please provide me temporary wp-admin info (wp-admin URL, username, password) to the Private Content area, this will allow me to thoroughly investigate and address your concerns more efficiently.
Regards,
July 8, 2024 at 12:24 pm #581725
pablovilcParticipantHello Hung,
Private content info is on private area,
Thanks
July 8, 2024 at 3:56 pm #581828
Hung PhamKeymasterHi pablovilc,
Try to add the following PHP code snippet to the child theme functions.php file to fix this
if ( ! function_exists( 'woodmart_wc_empty_cart_message' ) ) { /** * Show notice if cart is empty. * * @since 1.0.0 */ function woodmart_wc_empty_cart_message() { woodmart_enqueue_inline_style( 'woo-page-empty-page' ); ?> <p class="cart-empty wd-empty-page wc-empty-cart-message"> <?php echo wp_kses_post( apply_filters( 'wc_empty_cart_message', __( 'Your cart is currently empty.', 'woocommerce' ) ) ); ?> </p> <?php } add_action( 'woocommerce_cart_is_empty', 'woodmart_wc_empty_cart_message', 10 ); }
Kind Regards,
July 8, 2024 at 4:53 pm #581849
pablovilcParticipantHello Hung,
It does not work… but if I change “woocommerce” domain on:
<?php echo wp_kses_post( apply_filters( ‘wc_empty_cart_message’, __( ‘Your cart is currently empty.’, ‘woocommerce’ ) ) ); ?>
for
<?php echo wp_kses_post( apply_filters( ‘wc_empty_cart_message’, __( ‘Your cart is currently empty.’, ‘woodmart’ ) ) ); ?>
it works…
July 9, 2024 at 10:57 am #582005
Hung PhamKeymasterHi pablovilc,
Glad to hear your issue has been resolved. Keep us in mind for future questions and concerns, we’re always here to help!
Regards,
July 9, 2024 at 11:08 am #582021
pablovilcParticipantHi Hung,
No it is not solved, because there are a lot of string that are on woocommerce domain (like return to shop, addresses fields, etc), we cannot change all of this. Woodmart should load all woocommerce domain translations (as every other theme does…)
July 10, 2024 at 6:56 am #582243
Hung PhamKeymasterHi pablovilc,
To assist you in the best possible manner, I kindly ask that you please provide me screenshots that illustrate the problem on the front-end to the Private Content area, this will allow me to thoroughly investigate and address your concerns more efficiently.
Regards,
July 10, 2024 at 9:31 am #582280
pablovilcParticipantHi,
The problem is that Woodmart child theme is not loading translations in woocommerce_es-ES.mo and .po files.
If you change the theme, or look in the backend, the strings in those .mo and .po files do load, so they are correct.
In the img1 you can see how the default string ‘Your cart is currently empty.’ is not translated if the domain string in the img2 is ‘woocommerce’ (that string is correctly translated in the .mo and .po and if the default WordPress theme is activated it appears translated).
However, if the domain string is changed to ‘woodmart’ (img4) it is translated correctly.
In conclusion, with the Woodmart theme active the translations of the Woocommerce .mo and .po files are not loaded, while if you activate another theme or take a look at the backend all the strings are translated correctly.
Thanks in advance
Attachments:
You must be logged in to view attached files.July 10, 2024 at 12:37 pm #582370
Hung PhamKeymasterHi pablovilc,
Would you mind if I deactivate extra plugins for testing? Please confirm me back.
Regards,
July 10, 2024 at 12:38 pm #582371
pablovilcParticipantOf course, you can do it, but please, activate them after your tests if you dont mind
Thanks!
July 11, 2024 at 9:57 am #582592
Hung PhamKeymasterHi pablovilc,
When I deactivated Contact Form 7 and translation appeared well, it seems strange.
Please backup your contact form > delete the plugin and try to re-install it.
Regards,
July 11, 2024 at 10:51 am #582621
pablovilcParticipantHello hung!
Thank you very much! it is one of the few plugins that we have not deactivated in our tests because they have never caused us problems…
Thank you very much, we will investigate what happens with contact form and we will fix it.
Thank you!
July 11, 2024 at 1:24 pm #582659
Hung PhamKeymasterHi pablovilc,
Keep us in mind for future questions and concerns, we’re always here to help!
Regards,
-
AuthorPosts
Tagged: translations
- You must be logged in to create new topics. Login / Register