Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1333195

    Gnomo Bàgnolo
    Participant

    Hi

    I have carefully read all the related documentation (https://community.theme.co/kb/translation/), but I haven’t understood which is best practice in order to proceed in a “child environment”:

    Method A. – Translation in Parent Theme
    Upload translation files (both .po and .mo files )to /wp-content/themes/x/framework/lang

    Method B. – Translation in Child Theme, changing function.php
    Create a “languages” folder in your child theme, for example /wp-content/themes/x-child/languages and upload your translations to that file (maybe folder?), changing child themes functions.php as follow:

    add_action( 'after_setup_theme', 'load_child_language' );
    	function load_child_language() {
    		load_child_theme_textdomain( '__x__', get_stylesheet_directory() . '/languages' );
    }

    Method C. – Alternative Upload Method
    Rather than using a child theme, you could upload your translation to /wp-content/langauges/themes, the main difference being if you upload that way, you’ll need to use the text domain of the theme/plugin you are translating in the naming of the file. For example, for this article we’d use the X text domain which is __x__ and then with the language code like this: __x__-de_DE.po and __x__-de_DE.mo

    Method D. – Plugins

    1. qTranslate X – A free alternative to WPML, offering the ability to translate WordPress themes and plugins from the WordPress admin.
    2. loco-translate – Loco Translate provides in-browser editing of WordPress translation files

    Thank You

    #1333341

    Christian
    Moderator

    Hey there,

    Please choose Method B as that is for the child theme.

    Thanks.