Language automatic translation
-
Hello,
We’re using a French version of WP with Shoreditch theme and we cannot find where to edit text such as:
Read more (more-link) or 404 page text.
Thanks a lot for your help!
Best,
-
Hi @wpaiksas,
Can you try going to Settings > Site Language and select French? When I make this change on my test site, theme text is translated to the language I have selected there — in cases where there is a translation for that particular string in the theme.
Let me know how you get on.
Hi @gemmaevans,
Thanks a lot for your quick reply!
The site is already set to French.
Actually, I just want to know where I can edit and personalized some text that’s already showing in French.1. Read more link (more-link)
2. 404 page textThank you
Best,Hi @wpaiksas,
Oh I see! The text for these areas is stored in the theme’s template files (404.php, archive.php etc) and there are two options for changing it:
1. Create a Shoreditch child theme and modify the text in those template files (not the original theme files):
This means updating Shoreditch won’t overwrite any of the text changes you have made.
2. Use a plugin like
Say What?to translate specific strings:This will be a good option if you would rather not create a child theme. I haven’t used this plugin myself so I recommend reading through the description to see if you think it looks suitable.
Hi @gemmaevans
Thanks a lot again for your help!
I already have a child theme.
I located the files but:
1. archive.php
The more text I want to edit is showing in French since It’s a site in French. So I have no clue where to edit that text whish includes a mistake. I cannot find it in archive.php2. 404.php
Same here, the French text showing is automatically generated and I cannot find where to edit it.Thank you very much.
BestPS. I found the text I want to edit in the .po file but the modification is not showing in the site.
Hi @wpaiksas,
Okay, please try the following:
#1
Create a child theme (which you have already done) and make sure you have completed steps 1-3: https://developer.wordpress.org/themes/advanced-topics/child-themes/—
#2
Create a /languages directory in the child theme, and copy over the fr_FR.mo and fr_FR.po files from Shoreditch—
#3
Add the following code to the child theme’s functions.php file. This will help to make sure languages are being loaded from the child theme:function shoreditch_languages_setup() { load_child_theme_textdomain( 'shoreditch', get_stylesheet_directory() . '/languages' ); } add_action( 'after_setup_theme', 'shoreditch_languages_setup' );—
#4
Edit the fr_FR.po file using a .po editor (like https://poedit.net/).Doing it this way helps to ensure the .mo file is also updated. Just editing the .po file with a text editor doesn’t seem to work and the site continues using the original translation — which is likely to be why your modification isn’t showing on the site.
Let me know how you get on.
Hi @gemmaevans
Thanks! This is really a good idea but for some reason it’s not working.
I still have this text: Lire la suite de
When I want: Lire la suiteIt’s actually a mistake in the French version of Shoreditch theme.
I did everything you said and checked twice.
I have this in my functions.php file now:
<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); function shoreditch_languages_setup() { load_child_theme_textdomain( 'shoreditch', get_stylesheet_directory() . '/languages' ); } add_action( 'after_setup_theme', 'shoreditch_languages_setup' ); } ?>I clean the cache of course… it’s a mystery!
Best,
-
This reply was modified 7 years, 1 month ago by
wpaiksas.
Hi there,
Have you edited both the .po and the .mo files using poedit? If you’re only editing the .po file it won’t work.
-
This reply was modified 7 years, 1 month ago by
The topic ‘Language automatic translation’ is closed to new replies.
