[Resolved] I do not see the saved translation on the site
I’m new to this plugin. Everything is properly installed. I do not have any errors message. I can work on my translations. I can save them. The resulting .mo files seems to be properly saved to the server. However, I do not see my translations when I access the site. What I translate is a Theme I purchased. I Tried to clear my browser cache or use another browser but it’s not working.
Is there anyhting other than the wp-config language setting that needs to be done to activate the new translation file?
If the MO files are valid the onus is on themes and plugins to configure themselves correctly. Loco can’t help it if they’re not, but perhaps a few things to try:
Ensure your WPLANG setting is exact.
If the file is called
foo-fr_FR.momake sure you set “fr_FR” as the language and not just “fr”
Check Loco has named the files correctly and put them in the right place. It should do, but it also tries to guess what you meant to do when things aren’t exactly as it expects, so potentially weird things can occur if files are in non-standard locations or with non-standard names.
Check the theme is using its text domain properly and Loco has identified this in file names.
style.cssmay contain a tag like “Text Domain: foo” this should then be used as the filename.
Additionally the theme must pass “foo” in all its translation calls. Check the theme is doing these properly. You should see things like
__('some text', 'foo')
Check wordpress can see the MO file and is getting as far as even trying to load it. You can debug that in the core around here: https://github.com/WordPress/WordPress/blob/master/wp-includes/l10n.php#L455
I should write this up somewhere.
Thanks for your help. It gives me different things to look after. I’ll contact the theme author to get some help also on that side to verify with your advices.
I made a screen capture of my loco packages page. As you can see, we see 2 set of fr_FR links. However, on server, There is only one.
More strange is the MO file in the template column.
Something strange going on there. I can’t think of the top of my head how that could happen. You should only see POT files in that column.
It’s hard to help without seeing all the files, but this extra file might be something to do with it. Also check you’re only using one Text Domain reference in the whole theme.
I asked help from the author, but nothing yet.
On my end, I worked using your advices. It helped. Tee Text Domain was indeed not set anywhere. I created it and it cleaned what we see in the plugin settings:
Since the text domain created is “neosense”, I tried to rename the fr_FR.mo to neosense-fr_FR.mo. When I want to create a new language, loco see the the new file should begin by neosense. However, I still do not see any translation.
HEre is a code example of a string to be translated and displayed:
return str_replace('[…]', '<p><a href="'.get_permalink().'"><span>'.__( 'Read more', DPTPLNAME ).'</span></a></p>', $text); }
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
I entered debug code and I was able to validate that DPTPLNAME value is “neosense”.
Here is a sc of the translation menu. You can see the new neosense-fr_FR.mo file name and the fact that the String Read more is translated.:
Do you see anything wrong in all of that?
I need to establish if this is a problem with Loco, or a problem with your theme.
The only way I’ll get to the bottom of it with such fragmented information is to get hold of all your working files. You can email a zip file to email@example.com
One thing to note is that themes only need the text domain in the file name when they’re in the global languages directory. When they’re bundled with the theme itself, they must not have the prefix. You can see this by examining the source of the
I have the file and will look at it tomorrow.
I’ve looked at the files you’ve sent and I think the main problem is the file layout is simply a mess. Some files are prefixed when they shouldn’t be, some are in the wrong place or in multiple places.
You also have three namespaces being used, which although may not cause any technical problems, it’s confusing.
neosenseis the text domain, but your files are named
iguanaand the PO file has an internal project name of
All you need is one template named correctly
neosense.potfrom which you can create a French file
fr_FR.poand compile it to
I removed all the files that have at some point been duplicated into various locations and tested saving
neosense/languagesdirectory. then viewing the site with neosense theme enabled. It seems to work fine.
I’m not ruling out you having experience a bug with Loco and files got put in the wrong place, but I can’t reproduce any such error.
Part of the mess is related to my tests. I tried different versions name and directories in case it would be grabed at somepoint.
-I made some clean up with your advices. I deelted extra files
-I edited iquana.po and changed Avanti to neosense inside the file
-I renamed iguana to neosense.
-I removed my Text Domain value froms style.css (Was added by me to try to force it to use the right file)
-I made a few more translation, recompiled, sync, saved, tested. It was still not working. I then read about “then viewing the site with neosense theme enabled”. The theme I use is Neosense Child. I tried directly with neosense and many strings translate correctly. Are you aware of any modifications that needs to be done when using a Child theme?
A child theme won’t break parent theme textdomain loading unless it deliberately overrides it. Your child theme does nothing to load a text domain itself, so the parent neosense theme will load it via the
load_theme_textdomainthat I mentioned above. You should debug this function call to see what it’s doing and what it’s trying to load.
The neosense theme appears to load a custom configuration that it would appear you can alter in the admin area. This might be what’s breaking your child theme translations. If the text domain is dynamically changed to anything other than ‘neosense’ it will be looking for another file.
I’m afraid I can’t identify any problem with the Loco plugin that is causing your issue.
Can you let me know if I can close this support ticket?
- The topic ‘[Resolved] I do not see the saved translation on the site’ is closed to new replies.