WordPress.org

Forums

Child theme language files (1 post)

  1. c.bavota
    Member
    Posted 3 years ago #

    I'm making a child theme and I was wondering if I created the language file correctly. I took the parent theme's .po and I merged it with the .po file of the child theme so it looks something like this:

    #: parent/index.php:161
    msgid "Read more"
    msgstr ""
    
    #: child/header.php:73
    msgid "Welcome!"
    msgstr ""

    I placed the new .po file in my child themes languages folder. This is code that is in the parent theme to load the language file:

    // Make theme available for translation
    	// Translations can be filed in the /languages/ directory
    	load_theme_textdomain(PW_THEME_FILE, TEMPLATEPATH . '/languages');
    
    	$locale = get_locale();
    	$locale_file = TEMPLATEPATH . "/languages/$locale.php";
    	if ( is_readable( $locale_file ) )
    		require_once( $locale_file );

    Should I copy that code into the child theme's functions.php file or do I need to use the load_child_theme_textdomain() function?

    Any help would be appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic