Tagged: x
-
AuthorPosts
-
July 11, 2016 at 9:14 pm #1082511
TeranoxParticipantHi,
I’ve made the French translation using the x.pot and POEDIT but can’t get it to work…
Here’s what i’ve did,
1) Downloaded the x.pot from /wp-content/themes/x/framework/lang
2) Used POEDIT to translate the strings
3) exported fr_FR.po & fr_FR.mo files to /wp-content/themes/x-child/languages
4) opened and edited functions.php located on /wp-content/themes/x-child using the code
found on https://community.theme.co/kb/translation/ and here’s a copy paste of what it look like.<?php // ============================================================================= // FUNCTIONS.PHP // ----------------------------------------------------------------------------- // Overwrite or add your own custom functions to X in this file. // ============================================================================= // ============================================================================= // TABLE OF CONTENTS // ----------------------------------------------------------------------------- // 01. Enqueue Parent Stylesheet // 02. Additional Functions // ============================================================================= // Enqueue Parent Stylesheet // ============================================================================= add_filter( 'x_enqueue_parent_stylesheet', '__return_true' ); // Additional Functions // ============================================================================= add_action( 'after_setup_theme', 'my_child_theme_setup' ); function my_child_theme_setup() { load_child_theme_textdomain( '__x__', get_stylesheet_directory() . '/languages ' ); }4) My website had always been set to French (and core wordpress and some plugins are already set to fr_FR.
5) Cleared the cache and refreshed the page
6) TRANSLATION NOT WORKING! X remain in english.I’m gonna send you a private post following this one with the infos to connect to my website i’m sure there is something i’m doing wrong because it’s not the first time i do translation fo a theme/plugins….
July 11, 2016 at 9:16 pm #1082513
TeranoxParticipantThis reply has been marked as private.July 12, 2016 at 8:58 pm #1084106
LelyModeratorHi There,
Thank you for giving us the steps you have done so far and for the credentials. Upon checking, your homepage and other pages are now in French. Your single post pages are in FRENCH too. Would you mind clarifying on which part the translation is not working? This is so we can help you better.
July 13, 2016 at 8:43 pm #1085971
TeranoxParticipantFrench part are articles, pages and core wordpress.
Take a look at the “filter by topic” for the blog post filter and the “view post” section on the slide on top of it.
According to my PO/MO, this should be “Filtrer par Sujet” and “Voir l’article”.
There is nothing related to X that appear in frenchJuly 14, 2016 at 3:32 am #1086424
LelyModeratorHi There,
Please try adding this code on your child theme’s functions.php file:
add_filter('gettext', 'translate_text' ); function translate_text($translated) { $translated = str_ireplace('Filter by Topic', 'Filtrer par Sujet', $translated); $translated = str_ireplace('View Post', "Voir l'article", $translated); return $translated; }Hope this helps.
July 14, 2016 at 6:16 am #1086620
TeranoxParticipantit could but it will not resolve the fact that i’ve translated the whole po/mo file and would like to benefit from it… how can i make it work and how it doesn’t work
July 14, 2016 at 7:19 am #1086697
TeranoxParticipantI just tought about it, on your code
add_action( 'after_setup_theme', 'my_child_theme_setup' ); function my_child_theme_setup() { load_child_theme_textdomain( '__x__', get_stylesheet_directory() . '/languages ' ); }do I have to change “after_setup_theme” and “my_child_theme_setup” with something?
like “x-child” or something or this code should remain as is on the website?
July 14, 2016 at 8:53 am #1086808
DarshanaModeratorHi there,
Every time when you change your translation file (fr_FR.po), you need to compile it to the machine readable format (fr_FR.mo) and then upload it into your child theme’s languages folder. For example (“/wp-content/themes/x-child/languages/”).
The above alternative method also should work for those specific strings and you don’t need to do any changes for your child theme code.
Both “Filter by Topic” and “View Post” language strings are already on our x.pot file. Please refer to our detailed guide here (https://community.theme.co/kb/translation/) and make sure that you have set it up correctly.
Thanks!
July 14, 2016 at 9:08 am #1086828
TeranoxParticipantI know, as I’ve said previously, it’s not the first time I’m using POEDIT for a WordPress Translation. I know POT, PO, MO,
I Could even send you both files. and as wrote at first on my post, i’ve went to the website you’ve posted, tried everything, Think there is not a file that doesn’t have the po/mo files in them and still not visible.
I’ve used the code you gave for now, by i want it fully translated by PO/MO, And I want to find why I can’t see it working.
Can you tell me if the “filter by topic” for the blog post filter and the “view post” section is part of X theme or it’s from cornerstone or an other plugin, I’m taking those 2 as a reference to see if it’s working…Maybe it’s part of an other POT that I haven’t touched yet.
PLease help…
July 14, 2016 at 1:37 pm #1087235
DarshanaModeratorHi there,
Those strings are available on x.pot file which comes with X theme. Would you mind providing us with your FTP credentials to take a closer look on your setup ?.
Thanks!
July 14, 2016 at 2:25 pm #1087316
TeranoxParticipantThis reply has been marked as private.July 14, 2016 at 10:27 pm #1087967
Rue NelModeratorHello There,
For best results, you need to place your translation files in this folder:
/wp-content/languages/themesYou might need remove your translation files from any other locations like in your child theme if you have added it.
And the correct file names are:
__x__-fr_FR.mo __x__-fr_FR.poHope this helps. Please let us know how it goes.
July 15, 2016 at 6:32 am #1088354
TeranoxParticipantOk…
So as per your document that say:
Create a “languages” folder in your child theme, for example /wp-content/themes/x-child/languages and upload your translations to that file.
That’s what i’ve did… My files whas named (at first) fr_FR.mo and fr_FR.po then somewhere else it said to name them __x__-fr_FR (what i’ve did)
Then as per your document i’ve placed the following code to my child’s theme functions.php
add_action( 'after_setup_theme', 'load_child_language' ); function load_child_language() { load_child_theme_textdomain( '__x__', get_stylesheet_directory() . '/languages' ); }What you just mentionned is what i’ve already did,
So what do I do now? If i’ve changed the location of the files to
/wp-content/languages/themes
Do I have to change the code or even do i really need it?All i’ve did came from https://community.theme.co/kb/translation/
July 15, 2016 at 7:52 am #1088424
TeranoxParticipant*********UPDATE********
I’ve found a string that has been translated in the customizer. So it mean the file work.
My new concern now is that if the other translations are not working, could it mean that there is something
that break the file?Don’t know if you can help here but could a wrong translation at some point will break all the translations below it?
I know that french accents sometime break codes in pages if entered badly but i don’t know how it react when entered in POEDIT.
I mean, will writting é à ù l’avion for the ( ‘ ) can damage the file?
I think I will do a test tonight and start from scratch with the POT and only translate a few line That I know where they are to see if it work. But for future reference I wonder if using accents in their final form instead of their coding counterparts are what make the translation going wrong.July 15, 2016 at 5:39 pm #1089135
RadModeratorHi there,
It will not damage the file, but could affect the string matching as they can be interpreted differently. If that’s the case, you’ll have to do the manual translation by using String Translation feature of the plugin like WPML.
Thanks!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1082511 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
