Articles of localization

Possibility to use WordPress built-in localization

Is it possible to use WordPress default / built-in localization without text domain when creating localization for theme or plugin? for example word like __( ‘Submit’ ) or __( ‘Publish’ ) or any other common words should already in the WordPress localization dictionary. But if we’re not specifying text-domain when creating theme it will not […]

Should I always prefer esc_attr_e & esc_html_e instead of _e?

I am working to internationalize my plugin. As I can see on WordPress site about esacaping, it says you should always use it. But as I can see in many popular plugins, they have used _e instead apart from few specific cases. So should I always use escaping or not for all strings, if not […]

Localization: Textdomain of Child teme

I am creating a series of WP child themes which are dependent of a parent theme which I will be using as a framework. I need to have these themes (both parent and children) localized. from http://codex.wordpress.org/Function_Reference/load_theme_textdomain I understood I need to add the following to my theme: add_action(‘after_setup_theme’, ‘my_theme_setup’); function my_theme_setup(){ load_theme_textdomain(‘mytextdomain’, get_template_directory() . […]

Multisite Network Localisation

The problem seems easy to solve – I have installed multisite network, each new page have Polish language set as default, polish localisation files are in right directory, in wp_config there is line: define(‘WPLANG’, ‘pl_PL’); Sites admin panels are correctly in polish language, but global network admin isnt. What am I missing to turn network […]

Strings including html for localisation

How to localise this string (including html) ? echo “<div class=’updated’><p>All options are restored successfully.</p></div>” ; Is this correct? echo ‘<div class=”updated”><p>’ . __( ‘All options are restored successfully.’, ‘mytextdomain’ ) . ‘</p></div>’; And how to go about this one? <p><?php _e( ‘On the <a href=”‘ . get_admin_url() . ‘import.php”>Import</a> page, choose the previously created […]

does a translation (i18n) have to start from an english PO?

i was wondering: it seems a translation must be a translation from english. I mean, the starting file is in english, then you do translations from that. But what if say, I’m Italian? So the base language is Italian and the others are translations from Italian? Because it’s just this: i’d like to have the […]

Possible to add a language file to a plugin without adding .po/.mo files to plugin directory?

I need to add a language file to an existing plugin. Not for translation reasons, but because I’d like to change all occurrences of a certain word to something else. While I could just drop another .po/.mo file set into the plugin’s languages directory, I don’t want to lose the language file when the plugin […]

Change WordPress Language

I am trying to change wordpress to Spanish. Including the admin. I went to my wp-config and defined the value i.e. define (‘WPLANG’, ‘es_MX’); I went to the settings -> general and set the language to es_MX I went to the update screen to change the language This is what I see: If you need […]

Localiztion in javascript

WordPress currently uses the gettext feature which is available in php but unfortunately not in Javascript. I have searched this matter on the web and have come up with this trick. But there is a problem as the php file needs to be called through WordPress system for the gettext feature to kick in. I’m […]

How to i18n text coming from the db or from an external source

I’m writing a plugin and i wanted to i18n correctly text which i’m storing in the db or in an external file. How should i do that?As of now we are generating pot files with wordpress and so all the Translatable text is in calls __( ‘text’, ‘plugin_name’); But there is some text i would […]