@fabe … be careful with your update. I think when I did mine is when the language translation stopped working. I’ve been trying for days to use the PO file and also the methods that you discuss. Maybe they are overriding each other.
If you happen to update with success, can you please notify the forum…thanks.
Also, what forum software do you use for this forum?
@fabe@laranz
OK…so dummy me. Fabe I see what you are saying and it is really easy using the method you describe and much easier than using wordpress to alter the PHP code and then using PO & MO files. The reason is that the Polylang plugin has a admin interface where you can input the strings for each language.
To Recap:
So, as discussed in this forum you must add the code and similar to this in the functions file pll_register_string( 'Button', get_theme_mod( 'illdy_jumbotron_general_first_button_title', __( 'Learn more', 'illdy-child' ) ), 'illdy-child' );
Then you must put onto your page something like this to print out the information from the Polylang string replacement.
THE MOST IMPORTANT STEP WHICH I MISSED
You must log into the Wordpress admin and then go to the language menu item and edit the string translations
Once you add the string translations to the functions.php, they will show up in the admin/string translations page. Then there, you will the newly added strings.
Exactly @storlab . Also I do not understand why the modifications haven’t been added to theme updates, since it would be extremely easy to do so, and have users translate their themes with polylang @laranz.
Yes exactly great you finally found the issue, each ML plugin have their string translations module.
Hi @rolandsguesthouse, What do you mean by that, I didn’t get your question. That is the default feature of any ML plugin, each has their own way of string translations.
I’ve just updated illdy theme without any issues. It works perfectly with my method. I didn’t lost anything with my child theme. You can update without fear.
Have a nice weekend.
Thank you all for sharing this solution. If I understand correctly, the goal is to make each element available on Polylang under Language > Strings Translation to be able to translate everything.
I have followed each of the steps detailed by @rolandsguesthouse and still don’t arrive to figure this out. I created the Child Theme with styles.css and the funtions.php files and ‘sections’ folder under it where I copied the front-page-bottom-header.php and modified it following your instructions. I started by adding only the First Button modifications in order to narrow the testing.
Since I cannot see what the code for the first_button is meant to look like in the php file in the previous post, I am guessing my problem might be there.
My functions.php and my front-page-bottom-header.php are currently as follows:
I seem to have the same problem…
The described solution doesn’t work for me
The string shows up in the translation section after modifying the functions.php but it has no effect on the site. I believe because I changed the content of the three word title and description in the customizer and I’m not able to load the demo content again.
Any ideas on how to proceed?
Thank you very much for your support!
Love
Jonathan
@laranz I think your help is urgently needed here. I got my theme to work, but it’s really more complicated than what I really understand, and people need your help. As far as I remember if some php files would be updated to work with polylang from sides of colorlib it would save everybody a lot of headache. Any help here? Thank you @laranz
1.) Do you have polylang plugin installed?
2.) Have you added the codes to the functions.php file?
3.) Then you need to login to the Wordpress admin, and edit the string translations. These can be edited in the admin area, after a new link is added for /languages/translations.
4.) Have you added a menu item to switch between languages? I used english, and mandarin so I have a link on the menu to switch between these languages.
It was a little confusing for me because there are multiple ways to have the system modify the languages. I don’t feel that you need to edit the specific page for the translation. It will be done automatically by the polylang.
Also…just to add…the string translations work like this…
“apple” replaced to “orange” So the example here is that they text you are replacing has to be exact in what you are attempting to replace. So double check these. Because this works, but it’s a little tricky.
For example, I had an article, that I wanted to replace text in. And you need to add this text into the functions page, and also then into the string translations page. Once these are perfected added in both spots, then the translation will occur.
Finally, the string translation is done by brute force…and by this I mean that it will replace any string translation that matches what you are attempting to convert.
I do manage to have all the strings show up in the string translation section. However, it doesn’t have any effect on the page - when I switch to English it still shows the German translation… any ideas on what to do?
Then you will need to make sure that the text used within the Wordpress Admin matches the text exactly that you use in the functions.php. So, from FABE’s example above.
The text in this example is “Contact Us”, and this text needs to match exactly what is used within the admin area where the theme is edited. The General Title within the theme editing area also needs to read “Contact Us” exactly! If it is slightly different with a capital, or an extra white space it is not exact, and therefore will not work. This is essential for the replacement to occur.
After this, you will need to match the text in the string replacement, with the text for the Two languages you are using…I think German and English.
For me the process of making changes to the functions.php and sections files described by @fabe remains unclear.
a) Can i ask anyone who managed to solve the issue to describe it step by step for dummies without php background (like an example for one of the sections) attaching the php code
b) Do I definitely have to use a child theme for the described process? Or a backup will be enough?
As i understood, i had to create the child theme BEFORE building the site. And in case of creating the child theme AFTER the site is already built, there gonna be additional things to fix to get the site to look like the original. (My case).
First child theme…The child theme does two main things;
1.) It allows you to modify theme files without them being overwritten the next time wordpress updates the core and the theme. One of the great things about WP is how easily and quickly it updates both the theme files and the core files. So, if you make changes in the functions.php file in a non-child theme…all of those changes will be lost the next time you update the theme. If if by accident, they can be lost forever.
It allows a novice to see and know easily what code they have worked on and quickly find the broken code.
To setup a child theme…it is generally easy…especially if you haven’t modified and PHP files by hand yet.
Hey @storelab,
thank you so much for your help - also to everyone else who contributed!
I managed to get it done!
Have a beautiful day!
Warmly
Jonathan