Articles of l10n

WordPress localization – gettext and git

We’re about to start working on localization of a highly customized wordpress theme with over 200 php files. We’re using git for version control. Are there any particular hints or warnings we should know about? Do we just stick the po/mo files in there with the theme? We’re probably going to try to use a […]

Theme doesn't want to load localization files

Here is my functions.php excerpt: function get_theme_text_domain() { //Same behavior if I return the string as ‘return ‘whatever’ $theme = wp_get_theme(); return $theme->get(‘TextDomain’); } function tamtando_theme_setup() { load_textdomain(get_theme_text_domain(), get_template_directory() . ‘/languages’); […] } add_action(‘after_setup_theme’, ‘tamtando_theme_setup’); $theme is an array with all theme’s properties: as expected. $theme->get(‘TextDomain’) returns ‘tamtando’: as expected. I’ve noticed that the theme […]

Multisite WPLANG won't save

I have a multisite workpress install (v 3.3.2). I’m trying to save the WPLANG field but nothing happens. I get the confirmation message “Site options updated”, but the field is still blank. And when I query it with get_locale, it get the default ‘en_US’. I’ve tried entering in: ja_JP ‘ja_JP’ “ja_JP” ja-JP ‘ja-JP’ “ja-JP” Thanks […]

Single translation for many locales

Greetings to everyone, Is it possible to do make a single translation for many locales? Let me explain it better: Can I create a single translation file for my theme called es.po and es.mo so it matches all possible variants for locales of the Spanish language? (i.e. es_ES, es_MX, etc.) The idea here is to […]

Using WordPress gettext functions in a library outside plugin or theme scope

If I have a library available through packagist that could be used in WordPress plugin or theme development, how should I address multilanguage support if I have a few strings that could be localized? I know that there has been some debate on composer usage in the WordPress world with very different views on it. […]

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: mysite.ie & the english mysite.co.uk 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 (http://spaceforaname.com/galleryview). 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 […]