Tagged: x
-
AuthorPosts
-
August 9, 2016 at 12:59 am #1123246
Hi,
Currently I have the problem that I can’t translate the shop title with WPML (see attachment). I use the title also for the breadcrumb (see attachment). WPML can not find the appropriate string. I use the icon stack and .
Thank you in advanced
Patrick
August 9, 2016 at 2:48 am #1123337Hi There,
Thanks for writing in.
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / passwordDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thanks.
August 9, 2016 at 7:18 am #1123571This reply has been marked as private.August 9, 2016 at 12:20 pm #1124053Hi again,
Thank you for providing the credentials. Try manual string translation method by adding the following code in your Child Theme’s functions.php file
add_filter ('gettext', 'x_translate_text', 99, 3 ); function x_translate_text ( $translated_text, $text, $domain ) { $translation = array ( 'Shop' => 'Geschäft' ); if( isset( $translation[$text] ) ) { return $translation[$text]; } return $translated_text; }
The $translation = array() contains the original string and the translation string. The original string should match the extract string you wish to translate. Any space or mismatched characters will invalidate the translation.
Hope this helps!
August 9, 2016 at 1:47 pm #1124223Hi Nabeel A,
thank you for the code. But it don’t works. Which is the correct string of the shop title appearance — icon — shop options – shop title?
This is actual my code in functions.php in child theme:
add_filter ('gettext', 'x_translate_text', 99, 3 ); function x_translate_text ( $translated_text, $text, $domain ) { $translation = array ( 'Shop - besondere Dekoideen und Holzspielzeug' => 'Geschäft' ); if( isset( $translation[$text] ) ) { return $translation[$text]; } return $translated_text; }
Is this correct. And how can I translate in WPML? WPML can’t find the string for translation.
best regards
PatrickAugust 10, 2016 at 10:56 am #1125721Hi Patrick,
Thanks for writing back.
It seems that the second part of what you are trying to translate:
besondere Dekoideen und Holzspielzeug
is a category name, try translating those separately.Like this:
<?php add_filter ('gettext', 'x_translate_text', 99, 3 ); function x_translate_text ( $translated_text, $text, $domain ) { $translation = array ( 'Shop' => 'Geschäft', 'besondere Dekoideen und Holzspielzeug' => 'your-translation' ); if( isset( $translation[$text] ) ) { return $translation[$text]; } return $translated_text; }
As in the code you posted, you had a hypen character in it, which is actually part of the breadcrumb path and not a string in itself.
Let us know if you still have any problems, we’re here to help. 🙂
Thanks!
August 10, 2016 at 10:56 am #1125722Hi guys,
can I get an answer?
Best regards
PatrickAugust 10, 2016 at 1:14 pm #1125981Hi Patrick,
Have you tried the solution provided by Jack?
Let us know.
Thanks
Joao
August 12, 2016 at 5:01 am #1128556Hey Jack and Joao,
thank you for your reply. I had written my message at the same moment as Jack. Sorry!
The solution of Jack don’t works. I would like to translate the string to the page title of the Shop Main page contains. There is no category but it show the shop title in the breadcrumbs.
I would like to translate SHOP – Besondere Dekoideen und Holzspielzeug to shop – special decoration ideas and wooden toys. But I can’t find the string with WPML to translate it.
I need translations in six languages (at,ch,en,gb,fr,es)
Best regards
PatrickAugust 12, 2016 at 8:25 am #1128729Hi Patrick,
Thanks for writing back and the additional clarification.
Would it be possible to provide me with FTP and WP Admin please so I can try and resolve this for you. If so please provide the details and make sure to check the box that says Set as private reply.
I’ll then check the template files and find the correct string.
Thank you!
August 13, 2016 at 2:28 am #1129697This reply has been marked as private.August 13, 2016 at 3:55 am #1129769Hello Patrick,
To translate it, you need to go to WPML > Translation Management and find the shop title “SHOP – BESONDERE DEKOIDEEN UND HOLZSPIELZEUG”. As of this moment, there was no translation added for this as shown here: http://prntscr.com/c55ugc
Hope this helps.
August 15, 2016 at 3:25 am #1131557Hello Rue Nel,
thank you for your reply! Your screenshot shows the translation of the page, but not the translation of the title in custom settings of X-theme. I need a possibility of translation of the shop title that shows in the attachment Ashampoo_Snap_2016.08.09_07h51m49s_002_1.jpg.
Thanks
PatrickAugust 15, 2016 at 11:21 am #1132136Hi there,
Let’s enable the translation first 🙂
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
1. Copy this file \wp-content\themes\x\framework\views\icon\woocommerce.php to your child theme (eg. \wp-content\themes\x-child\framework\views\icon\woocommerce.php )
2. Edit your child theme’s framework\views\icon\woocommerce.php and replace this line of code
<h1 class="entry-title"><?php echo x_get_option( 'x_icon_shop_title' ); ?></h1>
with this line,
<h1 class="entry-title"><?php echo __( x_get_option( 'x_icon_shop_title' ), '__x__' ); ?></h1>
3. Save and upload it.
4. Now translate the string “Shop – besondere Dekoideen und Holzspielzeug”
The x_get_option( ‘x_icon_shop_title’ ) is the one that holds the string from customizer. Adding __() will enable the translation for the string you added on customizer’s shop title.
Hope this helps.
-
AuthorPosts