Archived topic
Translation of new Element Hooks
11 replies · Started by Dani on August 21, 2018
I updated GP with the new elements and followed your migrating guide. All worked fine, but now there is a problem with the translation. I’m not able to get the admin_text strings in the WPML anymore. Luckily I've not migrated the hooks in my bilingual shop yet, just in the other shop, where I currrently only display the main language to customers.
I saw that the new elements is not part of your wpml-config.xml. I already tried generatepress_hooks, elements, generate_elements and generatepress_elements, but it’s not working. I must be missing something. The admin_text string cannot be found. Can you please help?
Hi there,
The new Elements are actually a custom post type, so they should be translatable by default: https://wpml.org/faq/how-to-translate-custom-types/
Let me know :)
Hi Tom,
unfortunately not working. When I create a translation of the hook as I would with any other custom post, it shows both languages on entire site.
For example I created a hook before footer that is supposed to show in the entire site:
German:
Kreditkarte, PayPal, Vorkasse uvm</br><p></p>
100% ssl verschlüsselt</br><p></p>
In der Regel 2-5 Tage</br><p></p>
Innerhalb Deutschland ab 50 €</br><p></p>
English:
Orders over 50 € within Germany</br><p></p>
International orders 2-10 days</br><p></p>
100% ssl connection</br><p></p>
Credit card, PayPal, SEPA etc.</br><p></p>
If I then go to the website, I see the hook showing in both languages. :(
Same with this after content hook:
German:
<?php if ( is_product () || is_cart() || is_checkout ()) : ?><p style="text-align:right; color:#333333; font-size:0.9em; padding:10px 0 0 0"> *Gilt für Standardversand innerhalb Deutschland. Bei Expressversand gilt 1 Werktag. Lieferzeiten für EU Länder findest du hier: Versand</p><?php endif; ?>
English:
<?php if ( is_product () || is_cart() || is_checkout ()) : ?><p style="text-align:right; color:#333333; font-size:0.9em;"padding:10px 0 0 0"> *Applies to int. shipping to EU countries. Delivery times for Germany can be found here: Shipping </p><?php endif; ?>
I copied the codes from the old GP hooks I used
Maybe it has to do with the display rule?
Strange - I would have to know more about how WPML decides which one to display. It may be worth asking them - I'd be happy to work with them to make sure Elements is compatible.
I just did a back-up and I'll leave the old GP hooks for now, which are working perfect for me. Yes, WPML is very helpful and they might have a solution, but I'm really a bit too busy at the moment. :( If I contact WPML that means creating a staging site again, delete all customers from database (GDPR) give them logins, many emails back and forth... As soon as I find more time, I'll contact WPML. I'll let you know if there's a solution.
Thanks! We'll try to get it tested ASAP as well.
Hi Tom,
just contacted WPML, if you want to follow the post: https://wpml.org/de/forums/topic/generatepress-translation-of-elements/
If it helps, I'm happy to provide you with an admin login to that site, too :)
Awesome, thank you! I'll keep an eye on that topic, and hopefully they know they can reach out to me at any time :)
Hi Tom,
you might already know this if you followed my post on WPML, but I thought just in case you didn't, they found a fix :)
https://gist.github.com/srdjan-jcc/00ee8d15afb3c6c1497af5ff92d32a8e
I still had some difficulties, but I assume it was because I didn't deaktivate GP hooks. Now it seems to work.
Have a good Sunday!
Awesome! Thanks so much for letting me know :)