Plugin Localization

i’ve just built my first plugin for wp, and even if it’s not a great “code poetry” 😉 it works as it should. It’s a plugin that transform the default wp gallery using the GalleryView 3.0 jquery plugin (http://spaceforaname.com/galleryview). The only thing i’m not able to do is localization. Localization for this plugin in means … Read more

Singular name Plugin localization

I’m trying to localize the singular name of a custom post type. … ‘singular_name’ => __(‘key’, ‘plugindomain’) … I created a .po and compiled it as .mo. I also loaded the translation using load_plugin_textdomain using the init action. // $directory plugin directory relative to plugins dir load_plugin_textdomain(‘plugindomain’, false, $directory); The string are localized correctly in … Read more

WordPress localization

In WordPress localization files (.po), does php map files by the line number eg. comments.php:60 or msgid msgid “<span class=\”meta-nav\”>&larr;</span> Older Comments”. So basically, if I have said string in comments.php in line 60, and move it to line 74, does it still get localized by the msgid? 1 Answer 1 if I have said … Read more

Localizing strings that come from outside of plugin?

Plugin queries remote API and under certain circumstances (mostly errors) displays textual messages from API responses. All messages in API responses are in English, but since they are more or less integrated in plugin it would make sense to make them localized and display-able in different language to match plugin’s interface. Theoretical question – should … Read more

Gettext details

I’ve got a few gettext() questions that are not covered anywhere in WordPress Codex but I think they are important. __(‘string’) in THEME should be used for strings that are likely to be present also in main WordPress translation file. No textdomain necessary. Examples: one, two, submit, cancel, remove and other common words. Correct? __(‘string’, … Read more

switch_to_blog(): Load textdomain

I am using the WordPress multisite feature with Multilingual Press Pro to create a multilingual site with linked posts. In a network activated plugin the custom post types are registered. For translating the slug I use l10n: ‘rewrite’ => array( ‘slug’ => __( ‘products’, ‘text-domain’ ) . ‘/%product-category%’, ‘with_front’ => false ) This works fine. … Read more