Articles of l10n

Localized WordPress content for different sub-locales of same language?

I have a site which serves Ireland & England. I want to move it to WordPress. Currently all the content is the same when you visit the site & it runs off two urls, the Irish one: & the english I need to show different prices based on whether the user is visiting […]

How to prepare SimplePie_Item's get_date() for l10n?

I’m trying to improve the localization of the Bones theme. On the admin side it provides an RSS widget which uses the following code: <?php echo $item->get_date(‘j F Y @ g:i a’); ?> This uses SimplePie, here’s the doc for the method. Which would be the best way to make this translatable?

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 ( The only thing i’m not able to do is localization. Localization for this plugin in means […]

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 […]

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 […]

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?

How do I translate: “2 hours and 15 minutes”?

I want to translate the generic phrase “x hours and y mintues”. Of course, if it’s only one hour, it should say “1 hour and y mintutes”. The same goes for minutes, “x hours and 1 minute.” I know _n() handles the single/plural issue, but what is the best practice on handling two numbers in […]

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. […]

How to get a traslated string from a language other than the current one?

I was wandering… All the translation functions (__(), _e(), _x() and so on) use the current/active language. Is there a way to get a translation from another language than the current one? For example, I’m on a French page and I want and english translation: how to?

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’, […]