Theme Options localization
-
Hi!
I’m building a child theme. For my options, I followed the instructions from Ian Stewart :
https://themeshaper.com/2010/06/03/sample-theme-options/.Here is my code…
add_action( 'admin_init', 'theme_options_init' ); add_action( 'admin_menu', 'theme_options_add_page' ); /** * Init plugin options to white list our options */ function theme_options_init(){ register_setting( 'prima_options', 'prima_theme_options', 'theme_options_validate' ); } /** * Load up the menu page */ function theme_options_add_page() { add_theme_page( __( 'Theme Options', 'prima' ), __( 'Theme Options', 'prima' ), 'edit_theme_options', 'theme_options', 'theme_options_do_page' ); } ... $statistic_options = array( '0' => array( 'value' => '0', 'label' => __( 'None', 'prima' ) ), '1' => array( 'value' => '1', 'label' => __( 'With comments', 'prima' ) ), '2' => array( 'value' => '2', 'label' => __( 'Without comments', 'prima' ) ) );
But I can not internationalize the first strings. The title is not translated either.
However, Poedit analyzes these strings correctly, and I can translate them. But they do not display correctly in the theme.
In functions.php, I use…
add_action( 'after_setup_theme', 'prima_child_theme_language' ); function iptima_child_theme_language() { load_child_theme_textdomain('prima', STYLESHEETPATH . '/languages'); $locale = get_locale(); $locale_file = TEMPLATEPATH . "/languages/$locale.php"; if ( is_readable( $locale_file ) ) require_once( $locale_file ); } require_once( dirname( __FILE__ ) . '/inc/theme-options.php' );
Any help would be greatly appreciate.
Thanks,
Vincent
- The topic ‘Theme Options localization’ is closed to new replies.