Handbook Examples: Language

Another round of examples, shall we? This one will focus on language examples.

I’ll start it off:

Required: load_theme_textdomain()

add_action( 'after_setup_theme', 'my_theme_setup' );
function my_theme_setup(){
    load_theme_textdomain( 'slug-text-domain', get_template_directory() . '/languages' );
}
// if child theme
add_action( 'after_setup_theme', 'my_child_domain', 11 );
function my_child_domain(){
    load_child_theme_textdomain( 'child-text-domain', get_stylesheet_directory() . '/languages'
}