How to translate Strings in the Customizer’s wp_customize array
-
I have a theme I’m working on and decided to check it up with the popular ThemeCheck plugin and I have two types of errors like these:
WARNING: Found a translation function that is missing a text-domain. Function esc_attr_x, with the arguments 'Search', 'lawyeah' WARNING: Found a translation function that is missing a text-domain. Function __, with the arguments 'TYPOGRAPHY OPTIONS'
I know from the research I have done that these errors have very much to do with Theme localization and Internalization. There are actually more errors of the second type and I’ve noticed that all of them are about the strings I have as descriptions for the sections I have in the WordPress Customizer. For example:
$wp_customize->add_section( 'typography' , array( 'title' => __( 'Typography', 'lawyeah' ), 'description' => __( 'TYPOGRAPHY OPTIONS','lawyeah' ), 'priority' => 30, 'panel' => 'lawyeah_theme_options', ) );
I’ve researched and tried a number of options but I can’t seem to get the errors away. I just don’t know how to fix these errors and I feel worn out already. I’ve desperately tried all the following in vain:
'description' => __e( 'TYPOGRAPHY OPTIONS','lawyeah' ), 'description' => esc_attr__( 'TYPOGRAPHY OPTIONS','lawyeah' ), 'description' => esc_html__( 'TYPOGRAPHY OPTIONS','lawyeah' ),
I’ve even tried this:
$typo_desc = __( 'TYPOGRAPHY OPTIONS', 'lawyeah' ); $wp_customize->add_section( 'typography' , array( 'title' => __( 'Typography', 'lawyeah' ), 'description' => __( $typo_desc,'lawyeah' ), 'priority' => 30, 'panel' => 'lawyeah_theme_options', ) );
May someone please save me and show me how to fix these errors. Thanks
- The topic ‘How to translate Strings in the Customizer’s wp_customize array’ is closed to new replies.