Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #85581
    Micke
    Participant

    Every time I get theme update the swedish language is gone, I tried to add a language folder to my childtheme folder but it don’t work. Is here anybody who can help me how to get the language from the childtheme folder?

    #85615
    Mahesh
    Participant

    Hi @micke,

    To load child theme’s translations files instead of parent theme, , add the following code in your child theme’s functions.php:

    // Load translation files from your child theme instead of the parent theme
    function my_child_theme_locale() {
    load_child_theme_textdomain( 'catch-kathmandu', get_stylesheet_directory() . '/languages' );
    }
    add_action( 'after_setup_theme', 'my_child_theme_locale' );

    Then add your translated files inside a “languages” folder in the child theme.

    Regards,
    Mahesh

    #85754
    Micke
    Participant

    Should there be <php? and ?> befora and after?

    #85757
    Micke
    Participant

    It worked, Thanks again for you help! The only thing was that I had to change this line: // Load translation files from your child theme instead of the parent theme

    To this: /* Load translation files from your child theme instead of the parent theme*/

    #85787
    Mahesh
    Participant

    Hi @micke,

    I assume there is already a <?php tag at the beginning of functions.php file. If the has been closed with ?> tag then you’ll need to <?php again but if the previous tag is not closed you don’t need <?php tag. you can omit the ?> tag at the end if there is in the code thereafter.
    In php // is used for single line comment and /* */ is for multiple line comment. You can remove the line, the comment is just to make us easy what that function does.
    Anyway you’ve fixed the issue and make it working, that is great.
    Have a nice day.

    Regards,
    Mahesh

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Languages’ is closed to new replies.