Translate titles of sections on the home page

Hello,

Now my personal website is in French and I need to translate it into Russian, English and Ukrainian. I use Polylang to do this but I can’t translate the titles of sections on the front page like “About Me”, “Projects”, “Contact us”, “Blog”. I tried to use PoEdit file as well but it changes nothing.

Could you please help me to resolve it ? Thank you a lot for any advices!

Lina

Hi @vgolovnya,

I’m trying as well to translate it but I have the same issue. Do you have translate “Jumbotron Section” with buttons? I can’t figure it out.
Thanks.

Regards,

Fabe

I fix it! I use polylang functions.

Finally I found soultion to do translation. You have to modify functions.php and each php where you want to translate.
For example, change “Contact-us” section title:
-> functions.php
pll_register_string( ‘Contact-us’, get_theme_mod( ‘illdy_contact_us_general_title’, __( ‘Contact us’, ‘illdy’ ) ), ‘illdy’ );’
->front-page-contact-us.php

<?php if( $general_title ): ?>
						<div class="col-sm-12">
							<h3><?php echo illdy_sanitize_html( pll_e( $general_title ) ); ?></h3>
						</div><!--/.col-sm-12-->
					<?php endif; ?>

Hope it’s help you.
My web: www.autentiks.com to check it

Hi @fabe,
Wow! It works fine! Thank you a lot for your help :wink:
And it is the same solution to translate the “Jumbotron Section” with buttons?
Thank you again !
Best regards,
Lina

@fabe, Oh dammed ! I have just tried your solution and I have a translation string that appears in my back-office of Polylang. But it changes nothing on the front-page. All four versions of my website keep the title that I wrote initially in options of theme’s customizer…
However, thank you :wink:

:smiley:
yes @vgolovnya you can do with buttons. Everything.
Please find for every elements of front page:

/**
 *  TRANSLATION PART
 */

/* JUMBOTRON PART */
pll_register_string( 'Button', get_theme_mod( 'illdy_jumbotron_general_first_button_title', __( 'Learn more', 'illdy' ) ), 'illdy' );
pll_register_string( 'Download', get_theme_mod( 'illdy_jumbotron_general_second_button_title', __( 'Learn more', 'illdy' ) ), 'illdy' );
pll_register_string( 'Jumbotron Tag Line', get_theme_mod( 'illdy_jumbotron_general_entry', __( 'lldy is a great one-page theme, perfect for developers and designers but also for someone who just wants a new website for his business. Try it now!', 'illdy' ) ), 'illdy' );
pll_register_string( 'First Word Header', get_theme_mod( 'illdy_jumbotron_general_first_row_from_title', __( 'Clean', 'illdy' ) ), 'illdy' );
pll_register_string( 'Second Word Header', get_theme_mod( 'illdy_jumbotron_general_second_row_from_title', __( 'Slick', 'illdy' ) ), 'illdy' );
pll_register_string( 'Third Word Header', get_theme_mod( 'illdy_jumbotron_general_third_row_from_title', __( 'Perfect', 'illdy' ) ), 'illdy' );

/* ABOUT-US SECTION */
pll_register_string( 'About-us', get_theme_mod( 'illdy_about_general_title', __( 'About', 'illdy' ) ), 'illdy' );
pll_register_string( 'About-us-entry', get_theme_mod( 'illdy_about_general_entry', __( 'It is an amazng one-page', 'illdy' ) ), 'illdy' );

/* BLOG SECTION */
pll_register_string( 'Latest News', get_theme_mod( 'illdy_latest_news_general_title', __( 'Latest News', 'illdy' ) ), 'illdy' );
pll_register_string( 'Latest News Entry', get_theme_mod( 'illdy_latest_news_general_entry', __( 'If you are interested in the latest articles', 'illdy' ) ), 'illdy' );

/* PROJECT SECTION */
pll_register_string( 'Projects', get_theme_mod( 'illdy_projects_general_title', __( 'Projects', 'illdy' ) ), 'illdy' );

/* SERVICES SECTION */
pll_register_string( 'Services title', get_theme_mod( 'illdy_services_general_title', __( 'Services', 'illdy' ) ), 'illdy' );
pll_register_string( 'Services entry', get_theme_mod( 'illdy_services_general_entry', __( 'Discover our services', 'illdy' ) ), 'illdy' );

/* CONTACT-US SECTION */
pll_register_string( 'Contact-us', get_theme_mod( 'illdy_contact_us_general_title', __( 'Contact us', 'illdy' ) ), 'illdy' );
pll_register_string( 'Contact-us-general', get_theme_mod( 'illdy_contact_us_general_entry', __( 'And we will get in touch as son as possible.', 'illdy' ) ), 'illdy' );
pll_register_string( 'Contact-us-general', get_theme_mod( 'illdy_contact_us_general_address_title', __( 'Address', 'illdy' ) ), 'illdy' );
pll_register_string( 'Custumer support', get_theme_mod( 'illdy_contact_us_general_customer_support_title', __( 'Customer Support', 'illdy' ) ), 'illdy' );

You have to change in every page for each element. Example:

<?php if( $general_title ): ?>
<div class="col-sm-12">
	<h3><?php echo illdy_sanitize_html( pll_e( $general_title ) ); ?></h3>
</div><!--/.col-sm-12-->
<?php endif; ?>

Have a good weekend!

I forget. You have to go to translation part of Polylang to register your modification.
Don’t forget to make some backup because with theme update I think it will erase everything.

@fabe,

Yes, I registered my modifications, erased the cookies and other historical stuff of my browser and… it works fine! Thank you a lot fot your help ! :slight_smile:

I have the child theme, so it must be fine after updates.

Have a good weekend :slight_smile:

This is just great, I’m happy that you all got the translation alright.

I will do my best to document @fabe’s instruction into a PolyLang translation guide, thank you once again!

Have a great upcoming week!

Hello Guys,

I’m trying to translate my Illdy Frontpage, but Im not quite understanding what I have to do. I have already installed Polylang and translated everything I can. But Im still missing the buttons, Jumbotron parts, about section and much more. I have located the .php file in the theme folder, but I dont understand what I have to change. Can you please help me with this?

Hello @fabe,

I have found the .php files from the wordpress Dashboard now. But is still completely unclear to me what I need to change in order to translate my About section and others. Do I need to erase some code and fill in the one you provided?

Hi,

Can you create a separate ticket and explain about your issue with screenshots and steps to recreate the issue? It seems you’re missing the widgets translation? In that case check this doc about widgets 5 – Widgets – Polylang also check other documentation links, if that helps.

Let us know,

Thanks,
laranz.

Hi…Roland…did you figure this out? I am having a similar problem.

You need to put the code that they sent to you into the theme file located at
/illdy/sections/front-page-bottom-header.php

in here you will post the sample code that is shown above. What this does is to take the text that that theme is using and rewrite it to the specific language. You also need to make sure that they .PO file is named properly with the language that you wish to translate…so I’m using simple chinese and the file is zh_CN.po and not the illdy.po file. The illdy.po is kinda like the original or backup but not used in language translation.

So strange, I had it working, and now something got messed up and I cannot figure out what I’ve done wrong. I think mine got messed up when I created a child theme…or when I updated something in the customize page of the theme editor. I have been wasting a lot of time and spinning my wheels to figure this out…

did you get your issues solved? @fabe @rolandsguesthouse

Hi @storlab,

Can you try this plugin Loco Translate – WordPress plugin | WordPress.org for translating the theme’s strings.

Let us know,

Thanks,
laranz.

Hello @storlab
@fabe helped me to sort this out. You have to create a sections folder in your child theme where you copy all the section php files to. Those section php files you can modify as previously mentioned. It worked for me. Let me send you everything @fabe send me.

Steps to take:

  • Create a child theme

  • Create a “Section” folder withing the child theme folder

  • Copy all the sections you want to translate into that folder:
    front-page-bottom-header.php, etc…

  • Modifiy the php sections as follows:

<?php if ( $first_button_title ): ?>

                                            <a>" title="&lt;?php echo esc_attr( $first_button_title ); ?&gt;" class="header-button-one"&gt;&lt;?php echo esc_html( pll_e ( $first_button_title )); ?&gt;</a>

                                    &lt;?php endif; ?&gt;

The part you need to add is the (pll_e ( )

The you also need to paste this into functions.php as follows:

/**

  • TRANSLATION PART
    */

/* JUMBOTRON PART */
pll_register_string( ‘Button’, get_theme_mod( ‘illdy_jumbotron_general_first_button_title’, __( ‘Learn more’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Download’, get_theme_mod( ‘illdy_jumbotron_general_second_button_title’, __( ‘Learn more’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Jumbotron Tag Line’, get_theme_mod( ‘illdy_jumbotron_general_entry’, __( ‘lldy is a great one-page theme, perfect for developers and designers but also for someone who just wants a new website for his business. Try it now!’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘First Word Header’, get_theme_mod( ‘illdy_jumbotron_title’, __( ‘Clean <span class=“span-dot”>.</span> Slick<span class=“span-dot”>.</span> Pixel Perfect’, ‘illdy’ ) ) );

/* ABOUT-US SECTION */
pll_register_string( ‘About-us’, get_theme_mod( ‘illdy_about_general_title’, __( ‘About’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘About-us-entry’, get_theme_mod( ‘illdy_about_general_entry’, __( ‘It is an amazng one-page’, ‘illdy’ ) ), ‘illdy’ );

/* TESTIMONIALS SECTION */
pll_register_string( ‘Testimonials’, get_theme_mod( ‘illdy_testimonials_general_title’, __( ‘Testimonials’, ‘illdy’ ) ), ‘illdy’ );

/* BLOG SECTION */
pll_register_string( ‘Latest News’, get_theme_mod( ‘illdy_latest_news_general_title’, __( ‘Latest News’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Latest News Entry’, get_theme_mod( ‘illdy_latest_news_general_entry’, __( ‘If you are interested in the latest articles’, ‘illdy’ ) ), ‘illdy’ );

/* PROJECT SECTION */
pll_register_string( ‘Projects’, get_theme_mod( ‘illdy_projects_general_title’, ( ‘Projects’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Projects entry’, get_theme_mod( ‘illdy_projects_general_entry’, esc_html
( ‘You’ll love our work. Check it out!’, ‘illdy’ ) ), ‘illdy’ );

/* SERVICES SECTION */
pll_register_string( ‘Services title’, get_theme_mod( ‘illdy_services_general_title’, __( ‘Services’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Services entry’, get_theme_mod( ‘illdy_services_general_entry’, __( ‘Discover our services’, ‘illdy’ ) ), ‘illdy’ );

/* TEAM SECTION */
pll_register_string( ‘Team title’, get_theme_mod( ‘illdy_team_general_title’, __( ‘Team’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Team entry’, get_theme_mod( ‘illdy_team_general_entry’, __( ‘Meet the people that are going to take your business to the next level.’, ‘illdy’ ) ), ‘illdy’ );

/* PROJECT SECTION */
pll_register_string( ‘Projects’, get_theme_mod( ‘illdy_projects_general_title’, __( ‘Projects’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Projects entry’, get_theme_mod( ‘illdy_projects_general_entry’, __( ‘You’ll love our work. Check it out!’, ‘illdy’ ) ), ‘illdy’ );

/* CONTACT-US SECTION */
pll_register_string( ‘Contact-us’, get_theme_mod( ‘illdy_contact_us_general_title’, __( ‘Contact us’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Contact-us-general’, get_theme_mod( ‘illdy_contact_us_entry’, __( ‘And we will get in touch as son as possible.’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Address’, get_theme_mod( ‘illdy_contact_us_general_address_title’, __( ‘Address’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Custumer support’, get_theme_mod( ‘illdy_contact_us_general_customer_support_title’, __( ‘Customer Support’, ‘illdy’ ) ), ‘illdy’ );

/* FULL WIDTH SECTION */
pll_register_string( ‘Full_width_general_title’, get_theme_mod( ‘illdy_full_width_general_title’, __( ‘Full-width’, ‘illdy’ ) ), ‘illdy’ );
pll_register_string( ‘Full_width_general_description’, get_theme_mod( ‘illdy_full_width_general_entry’, __( ‘Full-width Description’, ‘illdy’ ) ), ‘illdy’ );

Hi @storlab,

I didin’t use .PO files because I didn’t have any answers from this forum. I send all files to integrate it to this theme but it had been note integrated yet.
So I create a child them and copy all files needed. I modified every file with translation code you can see in my older post. Nothing more. You can check the results on my website: www.autentiks.com.
So you copy php files modified it with pll_e function and had it in your functions.php.
Let me know if you need something more.

Regards,

Fabrice

Hi guys,

Exactly. If you need something more, let me know.
Cheer.

Hi Fabrice,

Using .PO file is the easy way to manage string, copy the whole PHP files in to the child theme and doing is double work, you need to change string in each update.

Let us know,

Thanks,
laranz.

Hi @laranz,

I know but with this theme it didn’t work for me. I don’t like copy several files in child theme but I spent a lot of time trying to use PO files without success.
I have to update my website right now. I saw there is a new version of this theme.
Thanks a lot.

Regards,

Fabrice

Hi,

You’re welcome. :slight_smile:

Exactly which titles you’re referring to? Can you create a separate ticket with all the information, so that I can deep dive in to it, and will say that is possible or not, or provide a fix or forward the issue to the development team to fix in the upcoming version.

Let us know if you have any other questions,

Thanks,
laranz.