WordPress.org

Ready to get started?Download WordPress

Forums

Change text (25 posts)

  1. ehquionest
    Member
    Posted 1 year ago #

    Hello,
    my blog with a theme I am adjusting (Twenty Ten) is here
    I wonder how to change few text like "Laisser un commentaire" (Post a comment), "Une réponse" (1 comment) and so on.
    Is it in fr_FR.po file ?
    Thank you !
    Samuel

  2. CodeBotics
    Member
    Posted 1 year ago #

    Yes, it should be in your fr_FR.po file, assuming that is the same as twentyten.pot.

    Sorry I can't be of much more help than this!

  3. ehquionest
    Member
    Posted 1 year ago #

    I just realized now that there are 2 versions of this file :

    - one is in wp-content/languages
    - the other one is in wp-content/themes/twentyten/languages

    Do you know wich one is used by wordpress ?

  4. CodeBotics
    Member
    Posted 1 year ago #

    I'm not too familiar with translations, but I would guess at it using the theme specific translation file then the WordPress one.

  5. esmi
    Forum Moderator
    Posted 1 year ago #

    You should be looking at wp-content/themes/twentyten/languages.

    Never, ever, edit WordPress core scripts (ie anything outside the wp-content folder).

  6. ehquionest
    Member
    Posted 1 year ago #

    Ok so I am gona change fr_FR.po to generate a fr_FR.mo and upload this two files again to replace the two previous. But how to call this two files if they will be in a child theme (/twentyten_enfant/languages) ? With this code in my functions.php

    <?php
    add_action('after_setup_theme', 'my_twentyten_enfant_setup');
    function my_twentyten_enfant_setup(){
        load_theme_textdomain('twentyten_enfant', get_template_directory() . '/languages/');
    }
    ?>
  7. esmi
    Forum Moderator
    Posted 1 year ago #

    In a languages subfolder of your child theme.

  8. ehquionest
    Member
    Posted 1 year ago #

    Not sure to understand you esmi regarding my functions.php file ... ;-)

  9. esmi
    Forum Moderator
    Posted 1 year ago #

    Oh sorry. You shouldn't need to do anything more, The function is called by the after_setup_theme action.

  10. ehquionest
    Member
    Posted 1 year ago #

    So according to you, with this code my functions.php is correct ?

  11. esmi
    Forum Moderator
    Posted 1 year ago #

    Yes - with one possible exception that I've only just noticed. Try changing:

    load_theme_textdomain('twentyten_enfant', get_template_directory() . '/languages/');

    to:

    load_theme_textdomain('twentyten', get_template_directory() . '/languages/');

    Otherwise, none of the strings with the twentyten textdomain name will be translated in the parent or child..

  12. ehquionest
    Member
    Posted 1 year ago #

    Ok I didi it.
    Now it's still strange cause in my "twentyten_enfant" (child theme) /languages folder, I have two files fr_FR.po and .mo
    In the fr_FR.po I changed all "Laisser un commentaire" by "Publier un commentaire" and updated .mo file
    When I look on my blog, it's still written "Laisser un commentaire" nothing has changed. So now I am not sure it's in the .po and .mo that I have to change this translation...

  13. esmi
    Forum Moderator
    Posted 1 year ago #

    Ah - just noticed something else! You're calling the languages file from the parent theme. Try:

    load_theme_textdomain('twentyten', get_stylesheet_directory() . '/languages/');

  14. ehquionest
    Member
    Posted 1 year ago #

    So now it works for sure cause I change something in my fr_FR files and it has been updated on the blog ! Great thanks !
    However there is still something strange : if you look here http://test.sblanc.com/blog/ just bellow the volcano picture "Posted in...." and "Edit" are still in English. Does it mean that in my fr_FR.po file, this element is missing ?

  15. esmi
    Forum Moderator
    Posted 1 year ago #

    Yes - I assume so. I've double-checked the parent theme and those phrases are correctly identified with the twentyten textdomain name in the parent's functions.php file.

  16. ehquionest
    Member
    Posted 1 year ago #

    So I have to add them in my child languages files I guess ? I know how to modify an existing one, but not how to add a new one...

  17. esmi
    Forum Moderator
    Posted 1 year ago #

    You need to use a utility like PoEdit. It's a fairly simply process. Just add the __ and _e strings to the list that PoEdit looks for, point it at the theme folder and it will parse all of the translatable strings and create a .po file for you.

  18. ehquionest
    Member
    Posted 1 year ago #

    Sorry for my English. I have already the fr_FR.po file I found in WordPress french version and I open it with PoEdit.
    My request is : on my blog like here http://test.sblanc.com/blog/ it's written bellow the title "Posted on 12 octobre 2012", but I would like to have "Publié le 12 octobre 2012", and the same for other text on my website.
    Why I can't fine in fr_FR.po this sentence "Posted on" ? So if I can't find it, I can't translate it no ?
    Thank you ;-)

  19. esmi
    Forum Moderator
    Posted 1 year ago #

    No - try creating a new .po file.

  20. keesiemeijer
    moderator
    Posted 1 year ago #

    Another way to translate themes is by using this plugin: http://wordpress.org/extend/plugins/codestyling-localization/
    It can scan your theme for all translatable strings and create the po and .mo files.

    tutorial

  21. ehquionest
    Member
    Posted 1 year ago #

    Well I have to say I didn't no this plugin, ut works well indeed, but I still have to text impossible to translate even with that.
    Still like "Posted on", or the comment form ?
    Could it be in a php file ? Like loop or comment ?

  22. keesiemeijer
    moderator
    Posted 1 year ago #

    For twenty ten "Posted on" is in functions.php but it should be translatable as all other strings are.

  23. ehquionest
    Member
    Posted 1 year ago #

    You mean with the plugin you told me before ?
    Could it be because I am using a child theme ?

  24. keesiemeijer
    moderator
    Posted 1 year ago #

    If it's not going to work try creating a functions.php file in your child theme and put this in it:

    <?php
    function twentyten_posted_on() {
    	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
    		'meta-prep meta-prep-author',
    		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
    			get_permalink(),
    			esc_attr( get_the_time() ),
    			get_the_date()
    		),
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
    			get_author_posts_url( get_the_author_meta( 'ID' ) ),
    			esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
    			get_the_author()
    		)
    	);
    }
    
    ?>

    And translate the "Posted on" part.

  25. ehquionest
    Member
    Posted 1 year ago #

    Ok it works for the text just bellow the post title as I wanted, thank you !
    What about for the texte bellow the picture like here ? At this time it "Posted in"... ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags