[wp-hackers] Trying to add i18n

Tom Barrett tcbarrett at gmail.com
Tue Oct 23 06:08:33 UTC 2012


I'm trying to add language support to my plugin.

What I have done:

1. This is how I add my text domain.

add_action( 'init', 'tcb_wpg_localisation' );
function tcb_wpg_localisation() {
  load_plugin_textdomain( 'wp-glossary', false, plugin_dir_path(__FILE__) .
'/lang/' );
}

2. I used the wp.org 'Generate POT file' to create a .pot file - and put it
in /lang/

3. Installed http://wordpress.org/extend/plugins/codestyling-localization/ to
test and create .po and .mo files - translating 2 of the items.

4. Editing wp-config.php to change my language.

The problem:

I'm not seeing the translated text. Here are two code snippets:
1. the_content filter: $content .= '<div class="glossary-references"><h4>'
. __('Reference:', 'wp-glossary') . ' ' . $title . '</h4></div>';
2. CPT slug: 'rewrite' => array('slug' => __('glossary', 'wp-glossary')),


What have I missed?

-- 
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett


More information about the wp-hackers mailing list