• Greetings! This time around I want to change the language of the theme, and I haven’t found a way in the child theme itself to do it. I found a possible solution on this post, but as I’m not code savvy I’m not sure how it should be implemented. Again, thanks for all your help. Cheers!

    By the way, why can’t one search for a question on a theme’s forum in the WordPress Forum? It’s likely this question has been answered already, but there’s no way to look it up. At least I haven’t found one.

Viewing 10 replies - 1 through 10 (of 10 total)
  • As an English user, I’m not the best person to answer but I’m sure I’ll be corrected if I’m wrong.

    There’s a generic WP explanation here. I’ll make sure we produce a Snippet for this.

    To focus your searches, we did produce this Snippet.

    Thread Starter xondra

    (@xondra)

    Thank you rdellconsulting, but I desire to change only the child theme’s language, not that of my WP install. Cheers!

    What bits exactly do you want translated? Things like “post navigation”, “back to top”, “view all posts by…”, etc?

    Thread Starter xondra

    (@xondra)

    Yes, that’s exactly it, ElectricFeet

    If you want your child theme translated in multiple languages, here’s how to do it: add this to your functions.php:

    add_action( 'after_setup_theme', 'customizr_child_theme_setup');
    function customizr_child_theme_setup() {
        load_child_theme_textdomain( 'customizr-child', get_stylesheet_directory() . '/lang' );
    }

    Now, install Poedit, create a lang folder inside your child theme, set it’s base path to ../ (dot-dot-slash) and add a . (dot) path and click update. poedit will search all your child theme directory for any localization texts in the form of

    __('Text in default language', 'customizr-child');

    and will put them all in your .pot or .po file. There are more localization functions, __() is just one of them. More here. After that, you may add translations for as many languages you want. When the user will have ?lang=xx in their browser they will see the translation from the corresponding .mo file, in your lang folder.

    If you don’t want to internationalize your child theme and all you need is a translation of Customizr that hasn’t been done already, you should write to nikeo and maybe contribute with the translation yourself. He’ll tell you how it’s done.

    Thread Starter xondra

    (@xondra)

    The strange thing is that the theme comes with the po and mo files. The only thing it lacks is a button to change the language. At least I go to settings > general and I don’t have options to change the language there. So, do I still have to install poedit? I just want a line of code to use the files I already have.

    There is no such button. Not for any theme. Customizr takes WPLANG from WordPress and displays in that language. I’ll look deeper into this to see if I can make a function that changes locale for Customizr only.

    Change fr_FR from the following function into the locale of the language you want to see Customizr in and add the code to your child theme’s functions.php:

    add_action('after_setup_theme', 'change_customizr_locale');
    function change_customizr_locale() {
    	unload_textdomain('customizr');
    	load_textdomain('customizr', get_template_directory().'/lang/fr_FR.mo');
    	}

    I’m not sure if I’m clear exactly what you want. Your question seems to be asking how to set up basic language support, but then you mention a child theme, as if you want to set up the support only for your child theme.

    @acub has explained how to set up support just for your child theme.

    If you simply want to set up multilingual site the normal way, check out this article that I posted this afternoon.

    You dont have to translate anything, im usin customizr theme and spanish wordpress (https://es.www.ads-software.com/) and see everything in spanish, I suppose you have to translate your wordpress or install it in your language.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How do I change the language of the theme?’ is closed to new replies.